-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Add NetCoreAppCurrent rid agnostic tfm to libs #64518
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 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This change adds a NetCoreAppCurrent rid-less configuration which throws a PNSE to the following libraries: - System.Console - System.IO.Compression.ZipFile - System.IO.Compression - System.IO.FileSystem.DriveInfo - System.IO.MemoryMappedFiles - System.Net.Http - System.Net.Mail - System.Net.NameResolution - System.Net.Primitives - System.Net.Requests - System.Net.WebSockets System.Private.Runtime.InteropServices.JavaScript is excluded from that list as it doesn't have a contract and hence can't generate a PNSE assembly. Also it's currently a private assembly. These are the only libraries that were missing a RID agnostic tfm. Adding rid-less configurations, even if they just throw PNSEs helps with: - Platform enablement, i.e. a new "base" platforms like "Browser" usually require libraries that are RID specific to support them. By offering a RID agnostic PNSE tfm, projects can gradually support new platforms. - Making it possible to have ProjectReferences between libraries, i.e. imagine an microsoft.build.notargets / microsoft.build.traversal project with a `$(NetCoreAppCurrent)-$(TargetOS)` tfm which P2Ps all source projects. NuGet can't know that a $(NetCoreAppCurrent)-Linux tfm can reference a project with a $(NetCoreAppCurrent)-Unix tfm and will throw during restore, more precisely during the compatibility check. Ideally NuGet or the SDK would support targeting platforms from the runtime.json RID graph, including its compatiblity matrix but that isn't the case today. Even though the added tfms add to the build, I have other changes in the pipeline which depend on this one which will make the build noticeably faster.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ | |
| <WindowsRID>win</WindowsRID> | ||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||
| <DefineConstants>$(DefineConstants);HTTP_DLL</DefineConstants> | ||
| <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Android</TargetFrameworks> | ||
| <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Linux;$(NetCoreAppCurrent)-OSX;$(NetCoreAppCurrent)-FreeBSD;$(NetCoreAppCurrent)-MacCatalyst;$(NetCoreAppCurrent)-iOS;$(NetCoreAppCurrent)-tvOS;$(NetCoreAppCurrent)-Browser;$(NetCoreAppCurrent)-illumos;$(NetCoreAppCurrent)-Solaris;$(NetCoreAppCurrent)-Android;$(NetCoreAppCurrent)</TargetFrameworks> | ||
| <Nullable>enable</Nullable> | ||
| </PropertyGroup> | ||
| <PropertyGroup Condition=" '$(TargetsOSX)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetstvOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true'"> | ||
|
|
@@ -31,21 +31,29 @@ | |
| <PropertyGroup> | ||
| <ILLinkDirectory>$(MSBuildThisFileDirectory)ILLink\</ILLinkDirectory> | ||
| </PropertyGroup> | ||
| <!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. --> | ||
| <PropertyGroup> | ||
| <TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier> | ||
|
Member
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. Can we or is it worth to this globally for all projects that multitarget or is that an expensive call? I ask cause I see this property being set in multiple projects. I guess it won't work because of DesignTimeBuild but I figured I'd ask.
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. The SDK already does this but in the TargetFrameworkInference.targets file which means the property won't be for properties inside the project file. Because of that, we are setting it ourselves in exactly the same way the SDK sets it and the result will be cached and the duplicate is avoided. We can't set this globally as it relies on the TargetFramework prop which isn't available at that point. |
||
| <GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetPlatformIdentifier)' == ''">SR.PlatformNotSupported_NetHttp</GeneratePlatformNotSupportedAssemblyMessage> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <ILLinkSubstitutionsXmls Include="$(ILLinkDirectory)ILLink.Substitutions.xml" /> | ||
| <ILLinkSubstitutionsXmls Condition="'$(TargetsAndroid)' == 'true' or '$(TargetsiOS)' == 'true' or '$(TargetsMacCatalyst)' == 'true' or '$(TargetsTVOS)' == 'true'" | ||
| Include="$(ILLinkDirectory)ILLink.Substitutions.mobile.xml" /> | ||
| <ILLinkSuppressionsXmls Condition="'$(TargetsMobile)' == 'true'" Include="$(ILLinkDirectory)ILLink.Suppressions.Mobile.LibraryBuild.xml" /> | ||
| </ItemGroup> | ||
| <ItemGroup> | ||
| <ItemGroup Condition="'$(TargetPlatformIdentifier)' != ''"> | ||
| <Compile Include="System\Net\Http\ByteArrayContent.cs" /> | ||
| <Compile Include="System\Net\Http\ByteArrayHelpers.cs" /> | ||
| <Compile Include="System\Net\Http\CancellationHelper.cs" /> | ||
| <Compile Include="System\Net\Http\ClientCertificateOption.cs" /> | ||
| <Compile Include="System\Net\Http\DelegatingHandler.cs" /> | ||
| <Compile Include="System\Net\Http\DiagnosticsHandler.cs" /> | ||
| <Compile Include="System\Net\Http\DiagnosticsHandlerLoggingStrings.cs" /> | ||
| <Compile Include="System\Net\Http\EmptyContent.cs" /> | ||
| <Compile Include="System\Net\Http\EmptyReadStream.cs" /> | ||
| <Compile Include="System\Net\Http\FormUrlEncodedContent.cs" /> | ||
| <Compile Include="System\Net\Http\GlobalHttpSettings.cs" /> | ||
| <Compile Include="System\Net\Http\HeaderEncodingSelector.cs" /> | ||
| <Compile Include="System\Net\Http\Headers\KnownHeader.cs" /> | ||
| <Compile Include="System\Net\Http\Headers\HttpHeaderType.cs" /> | ||
|
|
@@ -128,6 +136,7 @@ | |
| <Compile Include="System\Net\Http\Headers\UriHeaderParser.cs" /> | ||
| <Compile Include="System\Net\Http\Headers\ViaHeaderValue.cs" /> | ||
| <Compile Include="System\Net\Http\Headers\WarningHeaderValue.cs" /> | ||
| <Compile Include="System\Net\Http\SocketsHttpHandler\SocketsHttpPlaintextStreamFilterContext.cs" /> | ||
| <Compile Include="$(CommonPath)System\IO\DelegatingStream.cs" | ||
| Link="Common\System\IO\DelegatingStream.cs" /> | ||
| <Compile Include="$(CommonPath)System\IO\ReadOnlyMemoryStream.cs" | ||
|
|
@@ -140,6 +149,8 @@ | |
| Link="Common\System\Net\HttpDateParser.cs" /> | ||
| <Compile Include="$(CommonPath)System\Text\SimpleRegex.cs" | ||
| Link="Common\System\Text\SimpleRegex.cs" /> | ||
| <Compile Include="$(CommonPath)System\Threading\Tasks\TaskCompletionSourceWithCancellation.cs" | ||
| Link="Common\System\Threading\Tasks\TaskCompletionSourceWithCancellation.cs" /> | ||
| <Compile Include="$(CommonPath)System\HexConverter.cs" | ||
| Link="Common\System\HexConverter.cs" /> | ||
| <Compile Include="$(CommonPath)System\Net\ArrayBuffer.cs" | ||
|
|
@@ -152,7 +163,7 @@ | |
| Link="Common\System\Net\Http\aspnetcore\Http3\QPack\H3StaticTable.cs" /> | ||
| </ItemGroup> | ||
| <!-- SocketsHttpHandler implementation --> | ||
| <ItemGroup Condition="'$(TargetsBrowser)' != 'true'"> | ||
| <ItemGroup Condition="'$(TargetPlatformIdentifier)' != '' and '$(TargetsBrowser)' != 'true'"> | ||
| <Compile Include="System\Net\Http\HttpHandlerDefaults.cs" /> | ||
| <Compile Include="System\Net\Http\HttpMethod.Http3.cs" /> | ||
| <Compile Include="System\Net\Http\Headers\AltSvcHeaderParser.cs" /> | ||
|
|
@@ -521,15 +532,6 @@ | |
| <Compile Include="$(CommonPath)Interop\Windows\SspiCli\SSPIWrapper.cs" | ||
| Link="Common\Interop\Windows\SspiCli\SSPIWrapper.cs" /> | ||
| </ItemGroup> | ||
| <!-- Common --> | ||
| <ItemGroup> | ||
| <Compile Include="System\Net\Http\DiagnosticsHandler.cs" /> | ||
| <Compile Include="System\Net\Http\DiagnosticsHandlerLoggingStrings.cs" /> | ||
| <Compile Include="System\Net\Http\GlobalHttpSettings.cs" /> | ||
| <Compile Include="System\Net\Http\SocketsHttpHandler\SocketsHttpPlaintextStreamFilterContext.cs" /> | ||
| <Compile Include="$(CommonPath)System\Threading\Tasks\TaskCompletionSourceWithCancellation.cs" | ||
| Link="Common\System\Threading\Tasks\TaskCompletionSourceWithCancellation.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup Condition="'$(TargetsUnix)' == 'true'"> | ||
| <Compile Include="$(CommonPath)System\StrongToWeakReference.cs" | ||
| Link="Common\Interop\Unix\StrongToWeakReference.cs" /> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.