dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.74k stars 1.07k forks source link

NETSDK1206 error when building the aspnetcore repo with latest 8.0 Preview 6 SDK build #33486

Open mthalman opened 1 year ago

mthalman commented 1 year ago

The following error occurs when attempting to build the aspnetcore repo with the latest 8.0 Preview 6 SDK build (e.g. 8.0.100-preview.6.23315.8):

/vmr/.dotnet/sdk/8.0.100-preview.6.23315.1/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(267,5): error NETSDK1206: Found version-specific or distribution-specific runtime identifier(s): win. Affected libraries: System.Security.Cryptography.Pkcs. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details. [/vmr/src/aspnetcore/artifacts/source-build/self/src/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj::TargetFramework=net8.0]

This is a new warning check added by https://github.com/dotnet/sdk/pull/32970.

This was caught by source-build's bootstrapping build workflow which validates the product can build itself using the SDK it produced.

halter73 commented 1 year ago

@elinor-fung This looks like an SDK issue to me. I cannot image that the "win" RID that System.Security.Cryptography.Pkcs is targeting is too specific considering that "win" is listed as one of the "portable RIDs" in https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/8.0/rid-asset-list#new-behavior.

elinor-fung commented 1 year ago

The warning is relying on the list of available RIDs in KnownFrameworkReference/KnownRuntimePack items for Microsoft.NETCore.App. It looks like aspnetcore explicitly updates the KnownFrameworkReference for Microsoft.NETCore.App to only have the target RID in source build: https://github.com/dotnet/aspnetcore/blob/6dd34f7baefd4995f544b9a3f95ccd3b43acf4d4/eng/tools/GenerateFiles/Directory.Build.targets.in#L63-L64 Resulting in win not being in that list. I don't quite understand what exactly it is for and why it doesn't prepend to the list (like in the product's generated BundledVersions props) - @halter73 would you know?

I expect https://github.com/dotnet/sdk/pull/33584 will indirectly fix this (won't warn anymore in this scenario), since it will find the win platform in the KnownRuntimePack items that aspnetcore does not modify to only have the target RID.

lewing commented 1 year ago

hitting this in runtime now that arcade took the sdk bump https://github.com/dotnet/runtime/pull/88827

elinor-fung commented 1 year ago

The issue https://github.com/dotnet/runtime/pull/88827 is hitting is slightly different. It has no FrameworkReferences at all, since it is building the framework. That would not be addressed after https://github.com/dotnet/sdk/pull/33584 - I'll look at how to make it handle that case. Filed https://github.com/dotnet/sdk/issues/34003.

elinor-fung commented 1 year ago

@mthalman what would be a good way to test this? I believe this should be addressed now. I tried building dotnet/dotnet with the warn_as_error=false removed from aspnetcore.proj, which seemed to work.

mthalman commented 1 year ago

Good to hear. I'll run a test build in CI to verify.

steveisok commented 11 months ago

I've got this a few times after cleaning and rebuilding runtime on osx. If I clean and rebuild again it seems to go away for a little while.

MichaCo commented 5 months ago

Getting the same warning now for Microsoft.Data.SqlClient 5.x when targeting <TargetFramework>net8.0</TargetFramework>

warning NETSDK1206: Found version-specific or distribution-specific runtime identifier(s): win7-x64, win7-x86. Affected libraries: runtime.win7-x64.runtime.native.System.Data.SqlClient.sni, runtime.win7-x86.runtime.native.System.Data.SqlClient.sni. In .NET 8.0 and higher, assets for version-specific and distribution-specific runtime identifiers will not be found by default. See https://aka.ms/dotnet/rid-usage for details.

Can I simply ignore this or what can I do here?