Skip to content
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

[Bug]: False NU1701 warning #11771

Closed
bouchraRekhadda opened this issue Apr 22, 2022 · 3 comments
Closed

[Bug]: False NU1701 warning #11771

bouchraRekhadda opened this issue Apr 22, 2022 · 3 comments
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:Restore Partner:MSBuild Resolution:NotABug This issue appears to not be a bug Type:Bug

Comments

@bouchraRekhadda
Copy link

NuGet Product Used

MSBuild.exe

Product Version

17.1.0.7609

Worked before?

Yes with MSBuild 16.11.2.50704

Impact

I'm unable to use this version

Repro Steps & Context

Sample reproduction project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netcoreapp3.1;net48</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Build" Version="17.1.0" />
  </ItemGroup>
</Project>

Building using MSBuild.exe : "C:\Program Files\Microsoft Visual Studio\2022\Professional\Msbuild\Current\Bin\MSBuild.exe" ConsoleApp2.csproj /t:restore /v:m generate NU1701 warning

warning NU1701: Package 'Microsoft.Build 17.1.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project

The used package reference is both compatible with .NET 6.0 and .NET Framework (from it's nuspec file)

    <dependencies>
      <group targetFramework=".NETFramework4.7.2">
         ...
      </group>
      <group targetFramework="net6.0">
        ....
      </group>
    </dependencies>

The issue seems related to #11564 since the Microsoft.Build nuspec doesn't explicitly list .NET Core 3.1 as a supported Framework (not sure though).

Verbose Logs

>warning NU1701: Package 'Microsoft.Build 17.1.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project
@kartheekp-ms kartheekp-ms added Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:Restore WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed Triage:Untriaged labels Apr 23, 2022
@kartheekp-ms
Copy link
Contributor

@bouchraRekhadda - I am wondering if this behavior is by design. I am able to reproduce this issue even on VS 2019 (Version 16.11.13).

image

Did I miss anything in the repro steps?

@bouchraRekhadda
Copy link
Author

Did I miss anything in the repro steps?

The package Microsoft.Build version should be compatible with MSBuild version to be used; in case of VS 2019 the last version that used to work for us is 16.9.0, starting from 16.11.0 we can reproduce (here again what changed with this version is the supported TFMs in the nuspec file

  • 16.9.0
    <dependencies>
      <group targetFramework=".NETFramework4.7.2">
        ...
      </group>
      <group targetFramework=".NETCoreApp2.1">
        ...
      </group>
    </dependencies>
  • 16.11.0
    <dependencies>
      <group targetFramework=".NETFramework4.7.2">
        ...
      </group>
      <group targetFramework="net5.0">
        ...
      </group>
    </dependencies>

)

@ghost ghost added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Apr 25, 2022
@nkolev92
Copy link
Member

nkolev92 commented Apr 25, 2022

NU1701 is being raised based on the assets being carried.

16.11 has lib/net472 and lib/net5.0, none of which are compatible with netcoreapp3.1 without a fallback.

16.9 has lib/netcoreapp2.1 and lib/net472, out of which netcoreapp2.1 is fully compatible with netcoreapp3.1.

There's no NuGet bug here.
You can file an issue about the framework change in the msbuild repo if you'd like to, https://github.com/dotnet/msbuild/issues.

@nkolev92 nkolev92 added Resolution:NotABug This issue appears to not be a bug and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:Restore Partner:MSBuild Resolution:NotABug This issue appears to not be a bug Type:Bug
Projects
None yet
Development

No branches or pull requests

3 participants