-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Check in shim typeforwards and remove the dependency on the underlying targeting packs #79147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c9d95df
b844ddc
cf1d92f
2f5d410
baf02aa
5ec7527
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -4,59 +4,39 @@ | |||||
|
|
||||||
| <PropertyGroup> | ||||||
| <TargetFramework>$(NetCoreAppCurrent)-$(TargetOS)</TargetFramework> | ||||||
| <Nullable>disable</Nullable> | ||||||
| <EnableDefaultItems>true</EnableDefaultItems> | ||||||
| <!-- By default make shims compile against reference assemblies. --> | ||||||
| <CompileUsingReferenceAssemblies>true</CompileUsingReferenceAssemblies> | ||||||
| <IsPartialFacadeAssembly>true</IsPartialFacadeAssembly> | ||||||
| <GenFacadesIgnoreMissingTypes>true</GenFacadesIgnoreMissingTypes> | ||||||
| <!-- ensure the desktop compat shims reference the lowest possible version of dependencies | ||||||
| since those do not all ship as part of the framework and we don't want to force apps | ||||||
| to reference the latest packages. | ||||||
| netstandard.dll doesn't need to do this since it has no dangling dependencies --> | ||||||
| <GenFacadesForceZeroVersionSeeds Condition="'$(MSBuildProjectName)' != 'netstandard'">true</GenFacadesForceZeroVersionSeeds> | ||||||
| <!-- Ensure the .NET Framework shims reference the lowest possible version of dependencies since | ||||||
| those do not all ship as part of the framework and we don't want to force apps to reference the | ||||||
| latest packages. netstandard.dll doesn't need to do this since it has no dangling dependencies. --> | ||||||
| <GenFacadesForceZeroVersionSeeds Condition="$(NetFxReference.Contains('$(MSBuildProjectName);'))">true</GenFacadesForceZeroVersionSeeds> | ||||||
| <!-- Opt out of some features which are on by default. --> | ||||||
| <EnableLibraryImportGenerator>false</EnableLibraryImportGenerator> | ||||||
| <ApiCompatValidateAssemblies>false</ApiCompatValidateAssemblies> | ||||||
| <ILLinkTrimAssembly>false</ILLinkTrimAssembly> | ||||||
| <AddOSPlatformAttributes>false</AddOSPlatformAttributes> | ||||||
| <!-- Allow shim ref projects to reference source projects which is required for referencing shared | ||||||
| framework dependencies. --> | ||||||
| <SkipValidateReferenceAssemblyProjectReferences Condition="'$(IsReferenceAssemblyProject)' == 'true'">true</SkipValidateReferenceAssemblyProjectReferences> | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this is related to what you told me yesterday that refs don't necessarily expose all the public APIs that exist in src.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was also already in main just in a different location: runtime/src/libraries/shims/ref/Directory.Build.props Lines 5 to 6 in 39c02d9
Usually our reference source project must not have a TFM with a |
||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <ItemGroup Condition="'$(MSBuildProjectName)' == 'System.Runtime' or | ||||||
| '$(MSBuildProjectName)' == 'mscorlib' or | ||||||
| '$(MSBuildProjectName)' == 'netstandard'"> | ||||||
| <!-- Omit System.Void since C# doesn't permit the use of the `System.Void` | ||||||
| typename and instead requires callers to use the `void` keyword. --> | ||||||
| <GenFacadesOmitType Include="System.Void" /> | ||||||
| <Compile Include="$(MSBuildThisFileDirectory)System.Void.cs" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| <!-- Include any forwards needed by both ref and src projects. --> | ||||||
| <Compile Include="$(MSBuildThisFileDirectory)$(MSBuildProjectName).forwards.cs" | ||||||
| Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildProjectName).forwards.cs')" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| <ProjectReference Include="$(MSBuildThisFileDirectory)..\sfx-src.proj" Condition="'$(RefOnly)' != 'true'" /> | ||||||
| <ProjectReference Include="$(MSBuildThisFileDirectory)..\sfx-ref.proj" Condition="'$(RefOnly)' == 'true'" /> | ||||||
| </ItemGroup> | ||||||
| <PropertyGroup Condition="'$(IsSourceProject)' == 'true'"> | ||||||
| <ContractProject>$(MSBuildProjectDirectory)\..\ref\$(MSBuildProjectName).csproj</ContractProject> | ||||||
| <IsRuntimeAndReferenceAssembly Condition="!Exists('$(ContractProject)')">true</IsRuntimeAndReferenceAssembly> | ||||||
| </PropertyGroup> | ||||||
|
|
||||||
| <ItemGroup Condition="'$(MSBuildProjectName)' != 'netstandard'"> | ||||||
| <!-- .NET Framework shims compile against OOBs and the netstandard shim. --> | ||||||
| <ProjectReference Include="$(MSBuildThisFileDirectory)src\netstandard.csproj" /> | ||||||
| <ProjectReference Include="$(MSBuildThisFileDirectory)..\oob-src.proj" Condition="'$(RefOnly)' != 'true'" /> | ||||||
| <ProjectReference Include="$(MSBuildThisFileDirectory)..\oob-ref.proj" Condition="'$(RefOnly)' == 'true'" /> | ||||||
| <ItemGroup Condition="'$(IsSourceProject)' == 'true'"> | ||||||
| <!-- If an extra reference source project exists, use its source. --> | ||||||
| <Compile Include="$(MSBuildProjectDirectory)\..\ref\$(MSBuildProjectName).cs" | ||||||
| Condition="'$(IsRuntimeAndReferenceAssembly)' != 'true'" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| <ItemGroup> | ||||||
| <!-- System.Data.SqlClient is not live built anymore, reference it manually to avoid tfm nuget selection fallback errors | ||||||
|
ViktorHofer marked this conversation as resolved.
|
||||||
| when the TargetOS i.e. is MacCatalyst. Set Private false so that it doesn't flow down to consuming projects. --> | ||||||
| <PackageDownload Include="System.Data.SqlClient" Version="[$(SystemDataSqlClientVersion)]" /> | ||||||
| <Reference Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'system.data.sqlclient', '$(SystemDataSqlClientVersion)', 'ref', 'netcoreapp2.1', 'System.Data.SqlClient.dll'))" Private="false" /> | ||||||
|
|
||||||
| <!-- Use PackageDownload to not bring in System.Drawing.Common's dependencies (Microsoft.Win32.SystemEvents). --> | ||||||
| <PackageDownload Include="System.Drawing.Common" Version="[$(SystemDrawingCommonVersion)]" /> | ||||||
| <Reference Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'system.drawing.common', '$(SystemDrawingCommonVersion)', 'lib', 'net7.0', 'System.Drawing.Common.dll'))" Private="false" /> | ||||||
| <ItemGroup Condition="'$(GenFacadesForceZeroVersionSeeds)' == 'true'"> | ||||||
| <PackageReference Include="Microsoft.DotNet.GenFacades" | ||||||
| Version="$(MicrosoftDotNetGenFacadesVersion)" | ||||||
| PrivateAssets="all" | ||||||
| IsImplicitlyDefined="true" /> | ||||||
| </ItemGroup> | ||||||
|
|
||||||
| </Project> | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,21 +1,9 @@ | ||
| <Project> | ||
| <Import Project="..\Directory.Build.targets" /> | ||
|
|
||
| <PropertyGroup> | ||
| <!-- Tell GenFacades which msbuild item maps to the reference assembly to use. --> | ||
| <GenFacadesReferenceAssemblyItemName>GenFacadesReferenceAssembly</GenFacadesReferenceAssemblyItemName> | ||
| </PropertyGroup> | ||
| <Import Project="..\Directory.Build.targets" /> | ||
|
|
||
| <!-- Tell GenFacades to use reference assemblies instead of the implementation assemblies (for most of the shims). --> | ||
| <PropertyGroup Condition="'$(CompileUsingReferenceAssemblies)' != 'false'"> | ||
| <PropertyGroup Condition="'$(CompileUsingReferenceAssemblies)' == 'true'"> | ||
| <TrimOutPrivateAssembliesFromReferencePath>true</TrimOutPrivateAssembliesFromReferencePath> | ||
| <GeneratePartialFacadeSourceDependsOn>$(GeneratePartialFacadeSourceDependsOn);FindReferenceAssembliesForReferences</GeneratePartialFacadeSourceDependsOn> | ||
| <GenFacadesReferencePathItemName>ReferencePathWithRefAssemblies</GenFacadesReferencePathItemName> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup Condition="'$(MSBuildProjectName)' != 'netstandard'"> | ||
| <PackageDownload Include="Microsoft.NETFramework.ReferenceAssemblies.net48" | ||
| Version="[$(MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion)]" /> | ||
| <GenFacadesReferenceAssembly Include="$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', 'microsoft.netframework.referenceassemblies.net48', '$(MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion)', 'build', '.NETFramework', 'v4.8', '$(MSBuildProjectName).dll'))" /> | ||
| </ItemGroup> | ||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.AppWinStyle))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CallType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Collection))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.ComClassAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompareMethod))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.BooleanType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ByteType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.CharArrayType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.CharType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Conversions))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DateType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DecimalType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DesignerGeneratedAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.DoubleType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.IncompleteInitialization))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.IntegerType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.LateBinding))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.LikeOperator))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.LongType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.NewLateBinding))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ObjectFlowControl))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ObjectType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Operators))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.OptionCompareAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.OptionTextAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ProjectData))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.ShortType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.SingleType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.StandardModuleAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.StaticLocalInitFlag))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.StringType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Utils))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.CompilerServices.Versioned))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Constants))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.ControlChars))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Conversion))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DateAndTime))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DateFormat))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DateInterval))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.DueDate))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.ErrObject))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.DeleteDirectoryOption))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.FieldType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.FileSystem))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.MalformedLineException))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.RecycleOption))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.SearchOption))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.SpecialDirectories))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.TextFieldParser))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.UICancelOption))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileIO.UIOption))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FileSystem))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Financial))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FirstDayOfWeek))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.FirstWeekOfYear))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.HideModuleNameAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Information))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Interaction))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.MsgBoxResult))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.MsgBoxStyle))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.MyGroupCollectionAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.OpenAccess))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.OpenMode))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.OpenShare))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.SpcInfo))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.Strings))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.TabInfo))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.TriState))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VariantType))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VBFixedArrayAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VBFixedStringAttribute))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VBMath))] | ||
| [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(Microsoft.VisualBasic.VbStrConv))] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <AssemblyVersion>10.0.0.0</AssemblyVersion> | ||
| <StrongNameKeyId>Microsoft</StrongNameKeyId> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="$(LibrariesProjectRoot)Microsoft.VisualBasic.Core\src\Microsoft.VisualBasic.Core.vbproj" /> | ||
| <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime\src\System.Runtime.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # .NETCoreApp shared framework facade assemblies ("shims") | ||
|
|
||
| The projects under this directory are pure facade assemblies (also called shims) and don't contain any source code aside from `System.Runtime.CompilerServices.TypeForwardedTo` assembly attributes. | ||
|
|
||
| Currently, the following types of facades are checked-in: | ||
| - .NET Framework facade assemblies (i.e. mscorlib.dll) which enable loading .NET Framework compiled assemblies into a .NETCoreApp environment. | ||
| - .NET Standard facade assembly (netstandard.dll) which enables loading .NET Standard compiled assemblies into a .NETCoreApp environment. | ||
|
|
||
| Some facade folders contain reference source projects ("ref") in addition to source projects ("src"). Those might exist because of the source project referencing internal types. If only a source project exists, the compiled assembly will be included in both the targeting and the runtime pack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we not want the latest package to he referenced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already the same in main. Or are you asking about why we are doing this generally? IMO the comment captures that nicely. We make sure that shims don't depend on the very latest packages and instead work with any version. When you look at any of the shims in ilspy, i.e. mscorlib you will see that all dependency versions in its metadata are 0.0.0.0.