198

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)

11
  • 92
    @Nkosi hovering over them doesn't show anything for me
    – User1
    Oct 19, 2017 at 15:24
  • 1
    Check Errors window then
    – Nkosi
    Oct 19, 2017 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. Oct 19, 2017 at 15:31
  • 67
    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. Nov 28, 2018 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. May 6, 2019 at 18:20

23 Answers 23

176

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

11
  • 12
    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, 2019 at 2:31
  • 3
    The clasic "shut down" its not always the solution of all badness of the world :/
    – sgrysoft
    Feb 15, 2020 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 :) Mar 28, 2020 at 1:19
  • I had to do a clean/rebuild after the restart - but it worked.
    – Lavamantis
    Dec 23, 2020 at 17:11
  • 2
    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. Mar 8, 2021 at 13:14
76

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

5
  • 4
    Just reopening the solution instead of restarting VS worked for me too.
    – Quido
    Jan 1, 2020 at 16:56
  • 1
    why would I do dotnet restore? doesn't the build have to do that?
    – pabrams
    May 21, 2020 at 17:21
  • Still same issue in VS2022 and restore fixed it. Apr 20, 2022 at 16:27
  • dotnet restore and then restart VS2022 seemed to solve it for me. Feb 10 at 9: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 1 at 17:39
61

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.

0
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>
0
14

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.

2
  • 1
    Regarding projects, restarting Visual Studio (2019) seemed to fix it for me. Nov 8, 2019 at 12:26
  • there is no packages.coinfig
    – pabrams
    May 21, 2020 at 17:20
10

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.

1
  • 3
    In VS2019 the names for this menus seem be under Tools -> NuGet Package Manager -> Package Manager Settings
    – Joel
    Nov 8, 2021 at 23:32
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.

1
  • 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, 2022 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

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.

0
4

-unload project

-load project

This worked for me.

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
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!

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

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

2
  • 1
    This is one of a potential solution, I had faced such issue earlier. Oct 28, 2022 at 12:54
  • 1
    It's amazing that this is still an issue in 2022. Dec 14, 2022 at 13:17
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.

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!

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

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)

0

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.

-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

-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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.