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]: NU1701 - Package restore errors should mention which dependant package it came from #11758

Open
xPaw opened this issue Apr 19, 2022 · 5 comments
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Type:Bug

Comments

@xPaw
Copy link

xPaw commented Apr 19, 2022

NuGet Product Used

dotnet.exe

Product Version

6.1.0.103

Worked before?

No response

Impact

It bothers me. A fix would be nice

Repro Steps & Context

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net6.0-windows</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="SkiaSharp.Views.WindowsForms" Version="2.88.0-preview.179" />
  </ItemGroup>
</Project>

dotnet restore and nuget in Visual Studio 2022.

In my project I have SkiaSharp.Views.WindowsForms package, which depends on OpenTK (>= 3.1.0), OpenTK.GLControl (>= 3.1.0).

My project itself also depended on OpenTK.GLControl, while attempting an upgrade I briefly uninstalled this package, but nuget keeps saying that it fails to restore it.

It's not obvious that it's still trying to restore it because another package depends on it. This error message should print the dependency path.

Verbose Logs

Determining projects to restore...
GUI.csproj : error NU1701: Package 'OpenTK.GLControl 3.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 'net6.0-windows7.0'. This package may not be fully compatible with your project. [ValveResourceFormat.sln]

GUI.csproj does not have a reference to this package directly.

@kartheekp-ms
Copy link
Contributor

kartheekp-ms commented Apr 21, 2022

I agree that error message could be improved by adding package dependency path. One option that I can think of right now is, look at the package dependencies in either project.assets.json file or depedencies node in VS solution explorer.

image

@nkolev92 nkolev92 changed the title [Bug]: Package restore errors should mention which dependant package it came from [Bug]: NU1701 - Package restore errors should mention which dependant package it came from Apr 21, 2022
@nkolev92 nkolev92 added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Pipeline:Icebox labels Apr 21, 2022
@kenans
Copy link

kenans commented May 13, 2022

NU1701 used to be a warning and is still documented so. I wonder if there's any update that's elevated it to an error recently?

Another related issue on dotnet SDK dotnet/sdk#25338, which upgraded Nuget dependency from 6.1.x to 6.2.x. The issue also surfaced as error NU1701

--
Correction -- NU1701 are still warnings. We have <TreatWarningsAsErrors>true</TreatWarningsAsErrors> set on our project, and that's why it was surfaced as errors

@xPaw
Copy link
Author

xPaw commented May 13, 2022

I wonder if there's any update that's elevated it to an error recently?

I had warnings as errors in my csproj.

@kenans
Copy link

kenans commented May 17, 2022

UPDATE: we resolved the issue by removing all the incompatible transitive dependencies. After that, we no longer have NU1701 warnings. This sample project explains why NU1701 wasn't reported before, and why it got surfaced out since Nuget 6.2

@xPaw
Copy link
Author

xPaw commented May 17, 2022

This issue is about making the warning more informative, not resolving it.

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 Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:dotnet.exe Type:Bug
Projects
None yet
Development

No branches or pull requests

5 participants