You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
buildMultiTargeting unintentionally makes a package compatible with every framework #14338
The target frameworks supported by Microsoft.NET.Test.Sdk are net8.0 and net462, and the target framework of my project is net6.0. When building, the warning of nu1701 should be generated, but there is no warning now.
1.dotnet new console -f net6.0 -n Test
2.dotnet add package Microsoft.NET.Test.Sdk --version 17.14.0
3.dotnet build
I was able to reproduce the issue with the repro steps:
info : Package 'Microsoft.NET.Test.Sdk' is compatible with all the specified frameworks in project 'Test\Test.csproj'.
Basically, the props file in buildMultiTargeting makes the package compatible with every framework.
That being said, I don't love this because it effectively means anytime you need your package to have something that's outer build specific, it just makes it compatible with every framework.
Team Triage: We'll leave this as open and retitle, but changing this is a likely breaking change, albeit something we can estimate by analyzing all of the packages on NuGet.org.
I still have one issue. Why did I receive a warning from NU1701 when I merely modified the package name of Microsoft.NET.Test.Sdk, uploaded it to the private source, and then installed it?
Team Triage: We'll leave this as open and retitle, but changing this is a likely breaking change, albeit something we can estimate by analyzing all of the packages on NuGet.org.
@nkolev92 Do you have any plans or timeline for analyzing all the packages on NuGet.org to assess the impact, and for fixing this issue as soon as possible?
Activity
jebriede commentedon May 29, 2025
I was able to reproduce the issue with the repro steps:
info : Package 'Microsoft.NET.Test.Sdk' is compatible with all the specified frameworks in project 'Test\Test.csproj'.
nkolev92 commentedon May 29, 2025
Technically this is expected, https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Commands/RestoreCommand/CompatibilityChecker.cs#L362C1-L363C1.
Basically, the props file in buildMultiTargeting makes the package compatible with every framework.
That being said, I don't love this because it effectively means anytime you need your package to have something that's outer build specific, it just makes it compatible with every framework.
nkolev92 commentedon May 29, 2025
Team Triage: We'll leave this as open and retitle, but changing this is a likely breaking change, albeit something we can estimate by analyzing all of the packages on NuGet.org.
[-]NU1701 is missing[/-][+]buildMultiTargeting unintentionally makes a package compatible with every framework[/+]Varorbc commentedon May 29, 2025
I still have one issue. Why did I receive a warning from NU1701 when I merely modified the package name of Microsoft.NET.Test.Sdk, uploaded it to the private source, and then installed it?
nkolev92 commentedon May 29, 2025
Please upload the package somewhere we can access it so we can take a look.
Providing us the project would help too.
Varorbc commentedon May 30, 2025
@nkolev92 microsoft.net.test.sdk1.17.14.0.zip
nkolev92 commentedon May 30, 2025
The props and targets name has to match the package name: https://learn.microsoft.com/en-us/nuget/concepts/msbuild-props-and-targets.
Microsoft.NET.Test.Sdk.props but the package name is
microsoft.net.test.sdk1
That leads to the compat only considering the lib folder and not the build/buildMultiTargeting one.
Varorbc commentedon May 30, 2025
Thank you for your answer, I have no issue.
Varorbc commentedon Nov 26, 2025
@nkolev92 Do you have any plans or timeline for analyzing all the packages on NuGet.org to assess the impact, and for fixing this issue as soon as possible?
nkolev92 commentedon Nov 26, 2025
@Varorbc Please refer to https://github.com/NuGet/Home/blob/dev/Issue-Triage-Policy.md.
As a P3 issue, and especially as a DCR, we'd need community engagement because we'd consider the analysis and the impact of this potential change.