Skip to content

buildMultiTargeting unintentionally makes a package compatible with every framework #14338

Open

Description

@Varorbc

NuGet Product Used

dotnet.exe

Product Version

9.0.300

Worked before?

No response

Impact

None

Repro Steps & Context

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

Verbose Logs

Activity

  1. jebriede commented on May 29, 2025

    @jebriede
    Contributor

    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'.

  2. nkolev92 commented on May 29, 2025

    @nkolev92
    Member

    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.

  3. nkolev92 commented on May 29, 2025

    @nkolev92
    Member

    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.

  4. added
    Priority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.
    Type:DCRDesign Change Request
    and removed on May 29, 2025
  5. changed the title [-]NU1701 is missing[/-] [+]buildMultiTargeting unintentionally makes a package compatible with every framework[/+] on May 29, 2025
  6. Varorbc commented on May 29, 2025

    @Varorbc
    Author

    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?

  7. nkolev92 commented on May 29, 2025

    @nkolev92
    Member

    Please upload the package somewhere we can access it so we can take a look.
    Providing us the project would help too.

  8. Varorbc commented on May 30, 2025

    @Varorbc
    Author
  9. nkolev92 commented on May 30, 2025

    @nkolev92
    Member

    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.

  10. Varorbc commented on May 30, 2025

    @Varorbc
    Author

    Thank you for your answer, I have no issue.

  11. Varorbc commented on Nov 26, 2025

    @Varorbc
    Author

    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?

  12. nkolev92 commented on Nov 26, 2025

    @nkolev92
    Member

    @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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Functionality:RestorePriority:3Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog.Type:DCRDesign Change Request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions