dodegaard
dodegaard

Reputation: 1097

VS 2017 15.3 Yellow Triangles on References

This morning I upgraded to VS 2017 15.3 and now am getting yellow triangles for most of my references. The project runs fine (build is good in CLI and VS and restore has been run multiple times) that I can tell (and even better on dotnetcore 2.0 actually) but these remain. Has anyone else had this happen or have a suggestion? Thanks.

Link to project.assets.json file --> https://www.dropbox.com/s/c85yuyjiu4pnget/project.assets?dl=0

Yellow triangles in Solution Explorer

Also issue of greyed out usings and red references although everything builds and runs fine.

enter image description here

Warnings Window

Upvotes: 35

Views: 46350

Answers (9)

Darth Sonic
Darth Sonic

Reputation: 105

Quick solution for me and my colleagues if this happens:

Right-Click one of the references marked with yellow triangle and select "Properties" from context menu.

That is all. Seems that this is triggering some update of cache or similar.

Upvotes: 0

sgrysoft
sgrysoft

Reputation: 628

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.

Upvotes: 1

bantya
bantya

Reputation: 606

Today faced the same issue with an imported project.

Project with yellow symbols on references

FAILED ATTEMPTS: Tried updating nougat packages, checking improper imports and everything imaginable. No help.

SOLUTION: At last just tried building the solution and it worked!

Project with no yellow symbols on references

PS: Try building the project first. If it does not work then go for solution hunting.

Upvotes: 0

sgrysoft
sgrysoft

Reputation: 628

You could check my answer on relative topic here: https://stackoverflow.com/a/59704420/7969733

Just for documentation purpose for new person with this issue try this and you will rememberme :D

If you go to: Tools > NuGet Administrator > Configurations. and you have "Allow nuget...." and "automatically check...." cheked.

The only thing than you have to do is click con the button "Clear All NuGet Cache(s)"

That's it, you don't have to edit manual thinks than can be dangerous, believe me, I use to need to done some of the steps than describe here a lot of time, and try more than 5 steps of the official Microsoft documentation for that issue you could check it here: https://learn.microsoft.com/nuget/consume-packages/package-restore#restore-packages-automatically-using-visual-studio

But just cleaning the cache solve all the problems

To "Clear All NuGet Cache(s)" in Visual Studio 2019
Tools->NuGet Package Manager->Package Manager Setting

Upvotes: 2

GTAE86
GTAE86

Reputation: 1846

Mismatched Windows SDK Version between the referencing project and the references will cause it. In the vcxproj file it is "<WindowsTargetPlatformVersion>SDK Version</WindowsTargetPlatformVersion>"

I was upgrading from VS2012 to VS2017. Everything was good, then I upgraded to a new version of libtomcrypt and libtommath. Rather than tweak my existing projects, I up-converted the projects from the distributions from VS2008 -> VS2012 -> VS2017. In the process, I picked up Windows SDK Version 10.0.17763.0 in both the new projects. However, all of the projects that referenced those were 8.1, and thus the warning.

Upvotes: 1

Jean Claude
Jean Claude

Reputation: 21

I had a similar issue with visual studio 2017. And discovered that, if when I changed the dependency settings of the package I wanted to install (from lowest dependency to highest) everything worked fine.

Upvotes: 0

Lickut
Lickut

Reputation: 163

I had the same issue, some of the references were marked with the yellow triangle. However, I was able to build and run my project. I managed to remove these warning by following steps from this answer: .Net 2015 References with yellow triangle for Nuget packages on portable libraries

I turned on tracing for Visual Studio, I had next warnings in log files for all uncorrectly loaded references:

Encountered conflict between 'Reference:Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL' and 'Reference:C:\Program Files (x86)\Visual Studio\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\Microsoft.Win32.Primitives.dll'. Choosing 'Reference:C:\Program Files (x86)\Visual Studio\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\Microsoft.Win32.Primitives.dll' because AssemblyVersion '4.0.3.0' is greater than '4.0.2.0'.

To be precise, I did next steps:

  1. Removed error condition from my .csproj file
  2. Removed <Private>true</Private> parameter for not-loaded references in .csproj file
  3. Deleted not-loaded packages from \lib and \ref folders in corresponding MSBuild folder.
  4. Deleted packages from \packages folder in solution.
  5. Restored nuget packages.

I'm not sure all these steps are necessary, but it worked for me.

Upvotes: 2

Simon Fox
Simon Fox

Reputation: 10561

I was experiencing the yellow triangle on references issue after updating the projects in my (.NET 4.6.1) solution to the new .NET Standard .csproj format that comes with VS2017. The references I was getting warnings for were ProjectReference type (although it seemed to spill over into PackageReference for common packages in the projects in question).

I did not have any build warnings and there was nothing in the verbose build output to indicate what the cause could be.

I could follow all warnings back to a single project in my solution. I was able to solve by removing that project from my solution and then adding it back and re-adding only the necessary project references.

It seems the issue was related to unnecessary project references (or possibly circular) caused by the new transitive dependencies support. After removing the project and adding it back with only the minimum ProjectReferences and relying on transitive dependencies support to propagate the dependency, the warnings all disappeared.

This also solved an issue where the project in question was failing compilation during a command line msbuild initiated build on my CI server which only has VS2017 build tools installed (not the full IDE).

Upvotes: 7

dodegaard
dodegaard

Reputation: 1097

Update: VisualStudio twitter account responded to me to note that this is a bug and they are working on a fix for the future on this....

I have two responses to my post:

1) The using issue noted with things greyed out was actually a ReSharper issue. If you upgrade to VS 2017 15.3 and use R# make sure you update it as well to 2017.2.

2) The Yellow triangles issue is being looked at by the Visual Studio team but honestly I believe it to be linked to warnings in the build that those references are being coerced to either lower dependencies (ie Newtonsoft at different levels) or previews. The quickly evolving .NET 2.0 world may have exacerbated this issue. Yellow triangles have traditionally meant missing but check your warnings to see if that is related and then review the dependency chain. I will update this answer once I hear back from VS team (shout out to them and Damian Edwards + Scott Hanselman for helping me with this on Twitter).

Upvotes: 13

Related Questions