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

Unable to use Microsoft.Build.* 17.2.0 packages with .NET Core 3.1 #7679

Closed
bouchraRekhadda opened this issue Jun 6, 2022 · 4 comments
Closed
Labels
needs-triage Have yet to determine what bucket this goes in.

Comments

@bouchraRekhadda
Copy link

Product Version

MSBuild 17.2.1.25201

Worked before?

Yes with MSBuild 16.11.2.50704

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

Ask us questions

This issue was originally opened on NuGet/Home#11771 but as it turns out NuGet by design fallback on .NET Framework if no dependency group matches TFM (i.e. .NET Core 3.1 in my case).
Is there a way we could work around this properly (no warn disabling)?

@bouchraRekhadda bouchraRekhadda added the needs-triage Have yet to determine what bucket this goes in. label Jun 6, 2022
@rainersigwald
Copy link
Member

Are you saying you want an error instead of the warning?

@bouchraRekhadda
Copy link
Author

Are you saying you want an error instead of the warning?

No. Is there a way to workaround this other than upgrading to .NET 6 or mute the warning ? I would have imagined the packages Microsoft.Build.* list all compatible TFM in their nuspec

@rainersigwald
Copy link
Member

Newer versions of MSBuild only run on newer .NET runtimes, so if you want to target the latest MSBuild, you'll have to update your target framework.

@bouchraRekhadda
Copy link
Author

Newer versions of MSBuild only run on newer .NET runtimes, so if you want to target the latest MSBuild, you'll have to update your target framework.

My bad. Thank you for your time, I'll close this then

@rainersigwald rainersigwald closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Have yet to determine what bucket this goes in.
Projects
None yet
Development

No branches or pull requests

2 participants