35

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

dodegaard
  • 1,087
  • 2
  • 10
  • 23
  • 3
    Maybe wrong .net set in project? Also this may be helpful: https://stackoverflow.com/questions/30484196/all-project-references-have-yellow-triangles-every-time-solution-is-loaded – BladeMight Aug 21 '17 at 21:15
  • 1
    This has something to do with the path of the DLLs to the references. – tRuEsAtM Aug 21 '17 at 21:17
  • 1
    Thank for feedback but solution and projects execute fine as before upgrade. That is weird part. All are nuget packages so no path. Major change in VS 2017 15.3 on what yellow triangles mean? – dodegaard Aug 21 '17 at 23:14
  • 1
    All refs are from Nuget. This did not happen prior to VS 2017 15.3. Thanks. – dodegaard Aug 27 '17 at 23:39
  • The problem with the greyed out using statements and red references turned out to be ReSharper needing to be updated when going to 2017 15.3. Make sure you are on R# 2017.2 otherwise might get weird on you. – dodegaard Aug 28 '17 at 19:23
  • @dodegaard - this seems really silly, but I opened up my csproj file, commented out the package references that the IDE was warning about, compiled (of course errors were encountered), restored the csproj, rebuilt, and the warning icons went away. – dingalla Nov 13 '17 at 18:33
  • @danny-v what version VS 2017 are you on? – dodegaard Nov 13 '17 at 21:29
  • 2
    @dodegaard: Enterprise 15.3.4 – dingalla Nov 14 '17 at 02:20
  • Make sure your Target Framework is the same for those projects. – Fabio S. Dec 23 '17 at 17:18

9 Answers9

13

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

dodegaard
  • 1,087
  • 2
  • 10
  • 23
  • 3
    I discovered yesterday that this happens if your NuGet package .NET Framework requirements aren't met by your solution's Target. For example... I am using the Microsoft.TeamFoundationServer.ExtendedClient package from NuGet. I had created a new project and was having this issue till I realized that that package specifies .NET 4.6 and I had configured my project for .NET 4.7.2. Retargeted the project, went to the NuGet console and did `Update-Package -reinstall` and it all cleared up. – jrypkahauer Aug 03 '18 at 18:35
  • 2
    Oh, and there was no alert, no warning, no suggestions or advice given... the ONLY indication I had that something was wrong was the yellow triangle on certain NuGet packages... the ones in the .NET Framework that were not compatible with my main NuGet package dependencies. – jrypkahauer Aug 03 '18 at 18:36
  • 1
    Thanks @jrypkahauer I also had a similar situation (referencing a new project in the solution) and it turned out to be a mismatch in .Net versions (4.5.2 vs 4.5). Once I downgraded the other project to v4.5 everything worked again. It is strange how VS2017 does not show any errors for this issue! – Ory Zaidenvorm Nov 29 '19 at 02:22
7

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

Simon Fox
  • 10,409
  • 7
  • 60
  • 81
2

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.

Lickut
  • 73
  • 1
  • 9
  • Thank you for saving my WinForms application. – WonderWorker Dec 12 '19 at 15:40
  • I think just removing the error condition did it for me (although had tried most of the other points you mention already) - had been battling with it for hours! – d219 Jun 30 '20 at 23:44
2

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

d219
  • 2,707
  • 5
  • 31
  • 36
sgrysoft
  • 588
  • 7
  • 14
1

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.

GTAE86
  • 1,780
  • 3
  • 29
  • 39
1

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
0

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.

0

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.

bantya
  • 576
  • 11
  • 23
0

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.

Darth Sonic
  • 105
  • 7