29

I just installed a package through NuGet, but it shows a yellow exclamation mark icon in my Solution Explorer, see screenshot below.

Why does this happen, and how can I resolve it?

enter image description here

CodeCaster
  • 147,647
  • 23
  • 218
  • 272
user7127000
  • 3,143
  • 6
  • 24
  • 41
  • 2
    There are no build errors – user7127000 Apr 13 '17 at 14:01
  • See my comment. An icon like that will have an accompanying **warning** in the Error List. – CodeCaster Apr 13 '17 at 14:02
  • Even if there is no error message, you can trigger one by removing and adding this package again in some cases. – Lex Li Apr 13 '17 at 15:30
  • Did you install the package "Microsoft.AspNetCore.Server.IISIntegration"? Did this yellow exclamation display on a new asp.net-core project? Have you try to change the MSBuild project build output verbosity to Detailed or Diagnostic(Tools->Options->Projects and Solutions->Build and Run) to check the Error list? – Leo Liu Apr 14 '17 at 02:52
  • 12
    Restart Visual Studio helped me – Alexander Trofimov Dec 09 '17 at 11:52
  • You could try to unload the project and load it back to solution. If doesn't help - reload NuGet cache and re-open the Visual Studio. – Dmitry Pavlov Feb 09 '18 at 10:19
  • Thanks Alexander... – Egli Becerra Apr 11 '18 at 14:10
  • I was able to drop to command line and run `dotnet restore` from the folder containing my solution to resolve an issue where I was seeing the exclamation icon. – Scott May 04 '18 at 17:48
  • 3
    I have been getting these yellow warnings on dependencies, and builds did not yield any errors, warnings, or messages. I think when people respond, they shouldn't assume. I've flagged CodeCaster's comment as rude or abusive as it is snippy AND incorrect. Had it been snippy and yielded correct information, I would upvote. – JakeJ May 17 '18 at 15:37

5 Answers5

30

Many times it is just that Visual Studio is out of sync. Closing the solution and re-opening will magically fix these errors in many cases. It's easy enough that it should be one of the first things you try.

Marc L.
  • 3,296
  • 1
  • 32
  • 42
ScottDPJ
  • 423
  • 4
  • 7
2

In my case I had to manually update targetFramework in packages.config where "problematic" nuget was referenced.

My steps:

  1. I checked the path where NuGet is installed
  2. I searched config where the NuGet is referenced within the solution
  3. I manually changed targetFramework according the last segment/directory of NuGet's installation path
    my screenshot
IvanH
  • 5,039
  • 14
  • 60
  • 81
JurajG
  • 21
  • 4
2

Sometimes this can happen somewhat persistently after changing the TargetFramework(s) on a project that has already been loaded into Visual Studio. In my experience, the easiest way to ensure things are working correctly after changing the TFMs on a project is to close the solution, manually remove all the relevant bin/obj directories as well as the .vs folder next to the solution file.

TheXenocide
  • 1,060
  • 8
  • 22
1

I know this is an old thread, but still, it happens even with VS 2022, when you move the project to a different physical location even with the same name. In many cases, absolutely all the dependencies are suddenly marked with a yellow or brown exclamation mark triangle. One solution is to remove one dependency and reload it via NuGet. Updating a dependency if possible does the same, and in both cases, apparently forces VS to get the right location of the dependencies.

men
  • 131
  • 1
  • 9
0

For me i had this while using flaui dependency which was not matching the TargetFramework after changing from net6.0 to net6.0-windows it worked.

csproj file

Moaad
  • 117
  • 1
  • 4
  • 13