Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core misconfigured Nuget package dependency - Unexpected package version warnings

I have an asp.net core project, which was working great few day earlier. I have it on github in a private repo. Yesterday it stopped working after installing an update from VS. I have searched all over the net and github, can't find any solution to this. The image of warning i am getting is attached. The warning description is as follows from Microsoft,

NU1603
Issue A package dependency specified a version that could not be found. A higher version was used instead, which differs from what the package was authored against. This means that restore did not find the best match. Each restore will float downwards trying to find a lower version that can be used. This means that restore goes online to check all sources each time instead of using the packages that already exist in the user package folder.
Common causes The package sources do not contain the expected lower bound version. If the package expected has not been released then this may be a package authoring error.
Example message NuGet.Packaging 4.0.0 depends on NuGet.Versioning (>= 4.0.0) but 4.0.0 was not found. An approximate best match of 5.0.0 was resolved.

I don't know how can i solve this ? it seems there is no solution out there, I have even reinstalled VS, cleared nuget cache, deleted packages from global folder but my solution isn't working.

Any help in regard will be highly appreciated.

VS Warning Message

like image 656
Aftab Ahmed Avatar asked Mar 08 '23 07:03

Aftab Ahmed


1 Answers

I guess you have NuGet 4.3 with VS 2017 15.3.
The coded NuGet warnings and errors are part of the 15.3 release which is basically the NuGet.exe 4.3 release.

Basically you have 2 options to solve this issue:

  1. Fixing the dependency tree by manually updating System.ComponentModel.TypeConverter package with version 4.1.0 or higher
  2. Use NoWarn to ignore/suppress this warning like described here, by editing you csproj file like below.

    <PackageReference Include="Castle.Core" Version="4.0.0"> <NoWarn>NU1603</NoWarn> </PackageReference>

like image 67
user2771704 Avatar answered Apr 25 '23 22:04

user2771704