Reputation: 1115
I have two brand new C# .NET Standard libraries. They each have a project reference to an older .NET 3.5 Framework library. Only one of the two have a yellow icon on the reference.
Everything builds and runs fine but the triangle still exists, why?
Upvotes: 4
Views: 5911
Reputation: 31721
It could also mean that the third party assembly you have on your machine is not registered in the gac and hence not being found. For older projects mostly if I have to hand copy over the dlls, I will then register them with this powershell script in the directory they reside in:
gci *.dll | % { gacutil /i $_.Name }
Upvotes: 0
Reputation: 3312
According to Microsoft, these yellow warning signs get added for every new reference and then removed once the reference is successfully added (=assumed guilty until proven innocent). If some yellow warning remains in the solution explorer, VS knows only that that reference is missing, but doesn't know why and can therefore not display a warning message in the Error window.
Not being able to find out why there is a warning sign is very annoying. The problem was reported, but Microsoft's standard response is: "This problem seems not to be requested enough to be resolved, but if you like, you can contribute your own solution."
So if you read so far, can you please go to developercommunity.visualstudio.com: tell me what's wrong with the reference 2 and vote this issue up, telling MS they should indeed fix this.
After spending hours trying to solve a none existing error, I gave up and closed VS. When I started it again, the problem was gone.
Upvotes: 3
Reputation: 101
These errors also occur when adding a NuGet package that is not compatible with the current .NET (such as .NET Framework app under .NET Standard or .NET Core, or a .NET version such as referencing .NET Framework 4.8 library from an older .NET version).
Check that the package dependency is the same as the project you're working with.
Upvotes: 2
Reputation: 28216
I would hope they have a better way to report reference issues than an unlabeled yellow icon.
Not sure if it's your real question. But you can check the Error List window to get details about why yellow icon displays on the References.
Everything builds and runs fine.
For some scenario, the build in VS can succeed although some build warnings occurs. And it will only fail when some build errors exist.
I add reference to ForTest.dll
in my project, this assembly is missing or not compatible with current project, then it displays yellow icon in References
. Now since in my project, it doesn't call functions from the ForTest.dll
, so it won't exactly affect my build process. Then the project builds successfully and runs fine.
I have tried looking at the build log, in detailed mode, for an error message, but cannot find anything obvious.
When building a solution with several projects, and set the log in Detailed mode
, it's easier to get lost
in the hundreds of build logs. Since the yellow icon only displays for one project, you can right-click the project=>rebuild
to build the project, it makes the message in build log more clear.
Or just use the Error List window as I suggest above to check the warnings and errors instead of hundreds of logs during Trouble-shooting.
In addition: If you can't find any info in Error List window, then maybe the reason why the yellow icon occurs is because VS didn't load the project well
. Please try right-click the project=> unload and reload the project
in solution explorer
. If it persists,close all vs instance and delete the .vs
folder in solution directory, and restart vs.
Upvotes: 5