question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New NU1701 errors appearing after May 10th release of SDK (6.0.300)

See original GitHub issue

Describe the bug

Our github actions started failing today with the following error: error NU1701: Package ‘RelaxNG 3.2.3’ 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 ‘net6.0’. This package may not be fully compatible with your project.

There were no changes to any code or project files to explain the sudden failure. I think this behavior used to be a warning?

If this was an intentional change I would expect to find it in the release notes but I didn’t see anything mentioning NU1701 or any update to the restore behavior,

To Reproduce

The workflow log for the first failure can be viewed here: https://github.com/sillsdev/TheCombine/runs/6376161726?check_suite_focus=true The PR that triggered it is here: https://github.com/sillsdev/TheCombine/pull/1659/files

Further technical details

Our log had one sdk sha on the build that worked: [builder 1/6] FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:fde93347d1cc74a03f1804f113ce85add00c6f0af15881181165ef04bc76bd00 and an updated one when it began to fail: [builder 1/6] FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:27372653b52f0e0215574be2d1e74db2e9e6b3f09ad74c5618f0f5788cd848dd

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:15
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
zivkancommented, May 16, 2022

.NET SDK 6.0.300 brings in NuGet 6.2, which fixed a long-standing bug with asset target fallback not bringing in dependencies, which causes runtime failures for affected customers. This only happens when package authors mismatch the package dependencies vs package assets (usually lib/ folder). NuGet has been warning package authors about this for 2-3 years, but page authors who use old versions of NuGet or ignore the warning might still be generating potentially problematic packages, plus older packages, the authors might not have been aware. There’s a good chance that’s the cause of the error you’re seeing. We have a sample which explains it better, with some links to issues if that help: https://github.com/NuGet/Samples/tree/main/AssetTargetFallbackTransitiveDependencies

Note, as @kenans points out, NuGet treats it as a warning. If your project uses <TreatWarningsAsErrors>true, or similar, then your project is asking to be broken by warnings. As documented in a few places, you can NoWarn those NuGet codes and they’ll neither warning nor error your build.

cc @nkolev92

1reaction
kenanscommented, May 13, 2022

Checking out the commit history, seems Nuget.Client dependency was upgraded recently, which might be related to the issue.

NU1701 used to be a warning and is still being documented so. Now it seems to be reported as an error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NuGet Warning NU1701
The warning let users know that the assets may not be 100% compatible. Solution. Change the project's target framework to one that the...
Read more >
c# - dotnet restore warning NU1701
csproj : warning NU1701: Package 'PusherClient 0.5.0' was restored using '.NETFramework,Version=v4.6.1' instead the project target framework '.
Read more >
Visual Studio 2022 suppress NU1701 by default
They are different from NU1701 and NU1702. So, the NU1701 error that you got wasn't suppressed by VS by default. I am wondering...
Read more >
Solution to Visual Studio 2022 messing up ...
The error shown when attempting to load the projects was: The project file cannot be opened. Unable to locate the .NET SDK.
Read more >
C# 11 and . NET 7 - Modern Cross-Platform Development ...
Since 1993, he has passed more than 80 Microsoft programming ... ing which version introduced new library features. I then present the ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found