204

I have just converted my PCL library to a new .Net Standard library and I have some Yellow Warning triangles on my Dependencies shown below:

enter image description here

During the conversion it brought all nuget packages across including dependencies so it could be dulicates.

How do I find out what the Yellow warning triangles represent?

EDIT

Build Logs:

To prevent NuGet from restoring packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages during build.' NU1605: Detected package downgrade: NUnit from 3.8.1 to 2.6.4. Reference the package directly from the project to select a different version.
MyProj.UI.Tests -> MyProj.Core.Tests -> NUnit (>= 3.8.1)
MyProj.UI.Tests -> NUnit (>= 2.6.4) NU1605: Detected package downgrade: NUnit from 3.8.1 to 2.6.4. Reference the package directly from the project to select a different version. MyProj.UI.Tests.iOS -> MyProj.UI.Tests -> MyProj.Core.Tests -> NUnit (>= 3.8.1) MyProj.UI.Tests.iOS -> NUnit (>= 2.6.4) NU1605: Detected package downgrade: NUnit from 3.8.1 to 2.6.4. Reference the package directly from the project to select a different version.
MyProj.UI.Tests.Android -> MyProj.UI.Tests -> MyProj.Core.Tests -> NUnit (>= 3.8.1) MyProj.UI.Tests.Android -> NUnit (>= 2.6.4)

JKennedy
  • 18,150
  • 17
  • 114
  • 198
  • Hover over them and it will tell you. Most times it is because it cannot find/resolve them or a conflict exists. If you also look in the Error window it tends to explain error in the solution. – Nkosi Oct 19 '17 at 15:23
  • 96
    @Nkosi hovering over them doesn't show anything for me – JKennedy Oct 19 '17 at 15:24
  • 1
    Check Errors window then – Nkosi Oct 19 '17 at 15:25
  • 4
    These references are used when you build your program. But they matter to the IDE as well, it needs to resolve them in order to provide IntelliSense. If that fails then you get the warning triangle. Use Build > Build to get an error message. – Hans Passant Oct 19 '17 at 15:31
  • @user1, Just like Hans comment, what is build error log in the output window? You can update your question with the build logs. – Leo Liu Oct 20 '17 at 09:26
  • @Leo-MSFT I have updated the question with some Build log information. Could the warning triangle on the `.Net Standard` library be because I have installed all the individual dependency package seperately into my project? – JKennedy Oct 20 '17 at 10:16
  • 69
    When this happened to me, there were no build warnings. The warning icon was just stuck in the UI. Unloading and reloading the project fixed it. – StackOverthrow Nov 28 '18 at 20:04
  • 3
    @TKK: I think this only lasts for a couple of mins, then the warning triangles apperar in the UI. At least that's what happened to me after reopening the solution. I thought it was fixed at first but then the warning triangles suddenly reappeared. – PussInBoots May 06 '19 at 18:20
  • You must drill all the way down to the package in question for hover to work. It will not show hover info at top level. And it will not show yellow triangle at the reference itself, so you have to know witch one or open them all. Easier to look in build warnings, but be aware that build warnings might be filtered away. – HakonIngvaldsen Aug 22 '19 at 09:28
  • Literally none of these answers applied for me, and yet it still compiles without warnings. Other times, it won't compile, and the warning error is very obscure. This is such a cluster. – Rei Miyasaka Nov 23 '20 at 04:12
  • delete the obj folder for the project, perform a Clean action and try to Build the project again. worked for me. – Etienne Jul 01 '21 at 08:01
  • try outside of the IDE, use `>dotnet build [your-solution.sln]`... it worked for me. – Jaider Aug 18 '23 at 20:15

24 Answers24

189

As trite as it sounds, try rebuilding then restarting VS - and get on with your day :)

Tim Tyler
  • 2,380
  • 2
  • 16
  • 13
  • 16
    Thank you for reminding me of the classic "try restarting it" solution :). Spent the last hour wondering why VS was removing my packages when I built my solution. I restarted VS and everything worked as expected. /ugh – Ryan E. Sep 19 '19 at 02:31
  • 3
    The clasic "shut down" its not always the solution of all badness of the world :/ – sgrysoft Feb 15 '20 at 12:10
  • 1
    I just updated today my Visual Studio 2019 with the latest version (16.5.1) to be exact. And the issue still exist but this solution still works :) – Willy David Jr Mar 28 '20 at 01:19
  • I had to do a clean/rebuild after the restart - but it worked. – Lavamantis Dec 23 '20 at 17:11
  • 3
    I think VS forgets to invalidate some cache that keeps that triangle there. I saw this after a failed NuGet installation and it indeed disappeared after rebuild + VS restart. – Alexei - check Codidact Mar 08 '21 at 13:14
  • You saved my day! Seems that this bug is still present in Microsoft Visual Studio Enterprise 2019 Preview, Version 16.11.0 Preview 1.0. Yours should be the accepted answer. – Matt Jun 17 '21 at 08:08
  • Got the same problem and a Build and restart of VS worked for me. Mine VS Version is 16.11.2 – ctong Sep 01 '21 at 16:13
  • This solution still works in VS2022 ... – jao Oct 28 '21 at 08:48
  • I had two unused references in my dotnet standard project. After right-clicking and running *remove unused references* the triangles went away - but only after rebuilding and restarting Visual Studio. – topsail May 09 '22 at 13:22
  • Had the same problem in VS2022, compiled and runs with only a few warnings and messages (porting a legacy problem to .NET 6). Restarted VS2022, and the problem goes away. – Nick Jul 25 '22 at 14:59
  • Sounds trite indeed but it worked for me on my VS2022, thank you! Not a very friendly design on behalf of VS when the only diagnostic you have is a warning icon. – Maxim Popov Dec 23 '22 at 23:58
  • Hugs all around - been there, done that, and thank you Tim for giving me an hour of my life back. – carbon1479 May 07 '23 at 19:24
  • OMG - once again, I should have tried restarting first! Thank you! – Jimmy T. May 10 '23 at 13:58
  • Ok Roy, I mean Tim, your "turn it off and back on again" suggestion worked this time. Yeesh. – Bill B Jun 09 '23 at 19:18
79

run dotnet restore before you do any complicated manipulation, you are going to be provided with a lot more info than in the error window or solution explorer.

You can run this command in the Package Manager Console:

Tools > NuGet Package Manager > Package Manager Console

Moffen
  • 1,817
  • 1
  • 14
  • 34
AlexandreG
  • 1,633
  • 2
  • 14
  • 18
  • 4
    Just reopening the solution instead of restarting VS worked for me too. – Quido Jan 01 '20 at 16:56
  • 1
    why would I do dotnet restore? doesn't the build have to do that? – pabrams May 21 '20 at 17:21
  • Still same issue in VS2022 and restore fixed it. – Ricardo stands with Ukraine Apr 20 '22 at 16:27
  • dotnet restore and then restart VS2022 seemed to solve it for me. – Chris Jensen Feb 10 '23 at 09:39
  • Isn't `dotnet restore` for a Core app? I ask because I'm trying to fix a .NET Framework 4.7.1 app, with 80 of those yellow triangles. Looking at the warnings in the Error List of Visual Studio, they all say "Could not resolve this reference. Could not locate the assembly", then it gives the assembly listed in the solution under the References group. – Rod Mar 01 '23 at 17:39
67

If you have the warning icon but no warnings and nothing appears to actually be wrong, right click the project > Unload Project > right click the project again > Reload Project. The icon appeared for a moment and then was cleared for me in Visual Studio 2019. This avoids a full Visual Studio restart.

xr280xr
  • 12,621
  • 7
  • 81
  • 125
  • After messing around with...everything...for an hour+, this finally worked for me (VS2022). Thanks. – entiat Jul 23 '23 at 22:10
  • WARNING: if you do what this answer suggests, all references from other projects to this project will be lost, and you will have to go add them back. (If you started with a clean working tree, then reverting the changes on project files will do it; but if not, you will have some work to do.) – Mike Nakis Aug 30 '23 at 11:14
15

In the build Log I happened to notice this:

C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.DefaultItems.targets(199,5): warning : A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs

I therefore went and uninstalled all packages that were listed as dependencies for the .Net Standard nuget listed here:

.NETStandard 1.1

  • Microsoft.NETCore.Platforms (>= 1.1.0)

  • System.Collections (>= 4.3.0)

  • System.Collections.Concurrent (>= 4.3.0)

  • System.Diagnostics.Debug (>=> 4.3.0)

  • System.Diagnostics.Tools (>= 4.3.0)

  • System.Diagnostics.Tracing (>= 4.3.0)

  • System.Globalization (>= 4.3.0)

  • System.IO (>= 4.3.0)

  • System.IO.Compression (>= 4.3.0)

  • System.Linq (>= 4.3.0)

  • System.Linq.Expressions (>= 4.3.0)

  • System.Net.Http (>= 4.3.2)

  • System.Net.Primitives (>= 4.3.0)

  • System.ObjectModel (>= 4.3.0)

  • System.Reflection (>= 4.3.0)

  • System.Reflection.Extensions (>= 4.3.0)

  • System.Reflection.Primitives (>= 4.3.0)

  • System.Resources.ResourceManager (>= 4.3.0)

  • System.Runtime (>= 4.3.0)

  • System.Runtime.Extensions (>= 4.3.0)

  • System.Runtime.InteropServices (>= 4.3.0)

  • System.Runtime.InteropServices.RuntimeInformation (>=> 4.3.0)

  • System.Runtime.Numerics (>= 4.3.0)

  • System.Text.Encoding (>= 4.3.0)

  • System.Text.Encoding.Extensions (>= 4.3.0)

  • System.Text.RegularExpressions (>= 4.3.0)

  • System.Threading (>= 4.3.0)

  • System.Threading.Tasks (>= 4.3.0)

  • System.Xml.ReaderWriter (>= 4.3.0)

  • System.Xml.XDocument (>= 4.3.0)

And the yellow warnings disappeared.

From here: https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-net-standard-2-0/

I have also found you can use the NoWarn property like below:

<ItemGroup>
  <PackageReference Include="Huitian.PowerCollections" Version="1.0.0" NoWarn="NU1701" />
</ItemGroup>
JKennedy
  • 18,150
  • 17
  • 114
  • 198
15

The yellow triangle means that the package physical file(s) is gone and no longer available on the Hard Drive.

This usually happens when issuing a get latest version request on source control in TFS, especially when using a new machine, and you want to get your project code from the TFS server.

It can also be caused by low quality internet connection which almost always will result in data loss, or corrupted downloaded files.

enter image description here

If the problem is missing a couple of packages, you can modify the packages.config file and remove these packages from the packages.config and re-install the missing packages via nuget packages manager.

But if the problem is missing more than a few packages, the best and fast way I use to retrieve missing packages is by:

  1. Opening a new instance of visual studio
  2. Create a new project solution with same project type like the one with missing packages (Example: ASP.Net MVC with Individual User Account)
  3. Update the packages of the new project to the latest to match the packages versions of the previous project solution
  4. Open the file explorer and navigate to packages folder in the new solution that you created
  5. Copy all contents of folder Packages by selecting all, Note do NOT copy the Packages folder itself only the contents inside the folder
  6. Paste that in your previous solution ( solution with the missing packages), in the Packages folder with overwrite existing items.
  7. Go to your packages folder in the solution explorer and expand it, then click the refresh button to see that many of missing packages are now showing without yellow triangle
  8. Lastly you will end up with a couple of missing packages, that are not included by default when you create new solution, you need to remove them from your packages.config file (the file which nuget package managers) reads to determine installed packages, and install those as new using the nuget package manager.

Note such problems related to missing files from projects are always hard to fix, and depends on developer experience, so don't expect an easy solution for this one.

On the cause of the error,Microsoft says it is a bug, but it can happen on any version of Visual Studio.

Prisoner ZERO
  • 13,848
  • 21
  • 92
  • 137
Ashraf Sada
  • 4,527
  • 2
  • 44
  • 48
9

For any new person with this issue: try this and you will remember me :D

Go to: Tools > NuGet Administrator > Configurations and verify that you have Allow nuget... and automatically check... checked.

After that, the only thing you have to do is click on the button "Clear All NuGet Cache(s)"!

That's it. You don't have to edit anything manually; that can be dangerous, believe me, I used to need to do some of the steps described here a lot of the time.

If you want to try the official Microsoft solution for this issue, you could check it here: https://learn.microsoft.com/es-es/nuget/consume-packages/package-restore#restore-packages-automatically-using-visual-studio

But just cleaning the cache solved all the problems for me.

Joe McMahon
  • 3,266
  • 21
  • 33
sgrysoft
  • 588
  • 7
  • 14
  • 5
    In VS2019 the names for this menus seem be under Tools -> NuGet Package Manager -> Package Manager Settings – Issung Nov 08 '21 at 23:32
7

-unload project

-load project

This worked for me.

Dymond
  • 2,158
  • 7
  • 45
  • 80
6

I just had this issue in VS2019 version 16.8.3 when renaming a .NET Core 3.1 project. Directly after renaming the project the yellow triangles appeared. Rebuild, clean, etc. nothing worked. Closing and reopening the solution solved it for me.

DeMaki
  • 371
  • 4
  • 15
  • This is exactly the scenario I went through with VS2022 17.1.0 and closing and reopening Visual Studio fixed it. Thanks – Bob Jul 14 '22 at 13:08
4

Oddly enough, my .Net Core 3 project needed me to simply click "Load project dependencies" from the context of the project, then the warning icon disappeared.

Helpful screenshot:

enter image description here

Coruscate5
  • 2,253
  • 17
  • 28
4

The yellow exclamation sign is usually because of missing references or unsupported dll. If you clone a repository then there are chances that many of the nugget packages will show yellow exclamation. If you have verified the project version and still, the problem exists you can try the below solution.

In the package manager console, select the project in which you are facing this problem and then type the following command.

Update-Package -Reinstall

This will force reinstall all the packages. This command will not update the version of NuGet packages, it will simply force reinstall them.

This solution worked in my case. I am using VS2019. Hope this will help others as well.

Sunny
  • 752
  • 1
  • 11
  • 24
2

It will help if you

  • remove bin folder and obj folder
  • clean the project
  • Better also to remove the cached packages from C:\Users\{user}\.nuget\packages

Then restore the packages. that work for me.

dotnet restore
Tarek El-Mallah
  • 4,015
  • 1
  • 31
  • 46
1

If I try to uninstall Microsoft.NETCore.Platforms as stated in the marked answer I get the following error:

Unable to uninstall 'Microsoft.NETCore.Platforms.1.1.0' because 'NETStandard.Library.2.0.3' depends on it.

I uninstalled the other packages, but I still get the NETSDK1023 error:

A PackageReference for 'NETStandard.Library' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see https://aka.ms/sdkimplicitrefs

Now I edited my .csproj and deleted the following part

<PackageReference Include="NETStandard.Library" Version="2.0.3" />

as stated in https://aka.ms/sdkimplicitrefs under Recommendations:

When targeting .NET Core or .NET Standard, never have an explicit reference to the Microsoft.NETCore.App or NETStandard.Library metapackages via a <PackageReference> item in your project file.

Now the warning is gone!

testing
  • 19,681
  • 50
  • 236
  • 417
1

I faced this error when I clone the project. the main reason was the Nuget packages couldn't restore and I find a solution by making nuget.org only active resource.

enter image description here

Make sure you select Nuget.org as only active resource.

Hope it helps

Shervin Ivari
  • 1,759
  • 5
  • 20
  • 28
1

I had the same issue , after banging my head 2 days I found that this is because

Long path was not allowed

For example two class libraries in my project had name length > or = 40 So they were not loading dependency of netstandard2.0

If you have the same case , You need to first update long path limit from registry and set its value to 1

see https://www.thewindowsclub.com/how-to-enable-or-disable-win32-long-paths-in-windows-11-10

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem

TAHA SULTAN TEMURI
  • 4,031
  • 2
  • 40
  • 66
0

I just updated Visual studio to 16.4.4 and the issue was resolved. The reference is fixed and no more yellow triangle. Thanks.

Ali Keserwan
  • 217
  • 1
  • 4
0

I had the triangles on referenced projects dependencies. I had added reference of

 System.Drawing.dll

.There was also warning in error list box . Removing it solved the problem for me. You know ,according to warning in error list System.Drawing.dll has forwarded to System.Drawing.Common and you need to install it through Manage NuGet Packages . Now it works properly.

0

Go to your project/solution directory and execute:

dotnet restore

Then you are done!

Alirio
  • 63
  • 2
  • 5
0

I just Mapped my local folders to the tfs code branch and had these issues,

I had to look into the project Build order, clean them one by one in order and build them after cleaning.(Or you can try cleaning the whole solution and build it again)

You can look into the project build order by Select the Solution > Project (From Top) > Build Order

Raj Rajput
  • 37
  • 1
  • 8
0

I had taht issue, when changing the output directory:

<BaseOutputPath>$(SolutionDir)</BaseOutputPath>

As soon as i deleted that property, everything worked fine! (VS 2022 v17.0 btw)

puaaaal
  • 196
  • 8
-1

None of the above worked for me. I had one project in the solution with warning triangles on the dependencies to other projects in the solution which caused lots of red errors in VS. However, it would build, run and debug just fine. I finally unloaded the project with a right click on the project name in the solution tree, and then reloaded the project and all is happy now. Thanks Visual Studio, smh. I am using VS 2019 16.7.1

user2178025
  • 184
  • 2
  • 10
-1

Right click on Solution and Rebuild Solution. It worked for me.

-1

I had the triangles on referenced projects dependencies. I just removed and added the dependencies to remove the triangle.

I am posting this answer just because no other solutions presented here helped me.

manymanymore
  • 2,251
  • 3
  • 26
  • 48
-1

Like I said in another post, about the same issue, this is only for documentation... I know that this was ready to solve it, and one of my answers was ready to say something about that, but, maybe some of you present the same error and none of this solution listed here solves the problem... I don't know why this problem comes with the global installation of .net 6, but, if you present this issue again, you need to go to

C:\Users\YourUsername.nuget

And delete all the content, don't be afraid, that's a cache generator than will be created again if is need it.

sgrysoft
  • 588
  • 7
  • 14
-1

Reopen Visual Studio worked for me.

Harrison Wu
  • 354
  • 2
  • 4
  • The question asks "How do I find out what the Yellow warning triangles represent?". What you've written doesn't appear to address that at all. – Quentin Apr 11 '23 at 08:15