spektro37
spektro37

Reputation: 307

Warning on project's NuGet dependencies without any errors on any specific NuGet package in the list

I have a project that has a yellow warning sign on the NuGet section icon under it's dependencies, but when I expand the NuGet list to see all NuGets, I don't see any warning signs on any of the NuGets in the list.

enter image description here

Can anyone advise what could be making this warning appear?

Upvotes: 1

Views: 869

Answers (1)

zivkan
zivkan

Reputation: 15081

When NuGet restores PackageReference projects it writes a project.assets.json file to the intermediate output directory (by default obj/) which contains not only information about packages and files in those packages, but stores restore warnings, so that it's possible to show the user the same warning on no-op restores. I believe that the .NET Project System reads this and displays the warnings stored in the file as the symbol you see in Solution Explorer, but I think it should also put the warnings in the Error List.

So, you could check your obj/project.assets.json file and see if there are any warnings stored in it. I think they're normally at the end of the file.

Another option is to go to the command line and run msbuild -t:restore, or dotnet restore --verbosity normal (the dotnet cli defaults to minimal). I'd be surprised if that doesn't show you warnings (assuming there really are warnings), but you could try detailed verbosity, but I expect that would mostly show you MSBuild processing information. If you think that NuGet is incorrectly not showing warnings due to no-op, you can use dotnet restore --force, which after taking a quick look at the NuGet targets file appears to be equivilent to msbuild -t:restore -p:RestoreForce=true, or just delete the project.assets.json file and restore normally.

Upvotes: 1

Related Questions