37

All my project (from the same solution) references are marked with a yellow triangle. The projects are all set to the same .NET version (4.5.1). The error log says:

The project 'CommonLibrary' cannot be referenced.

A way to temporarily fix the issue is to either:

  1. Remove and re-add the references
  2. Right click and choose Add Service Reference and immediatelly cancel.

However, the triangles come back every time I start the solution.

The solution is build successfully regardless or the issue. The real issue is that Resharper acts like the references don't exist.

Another thing that might be relevant is that I have 2 projects that are supposed to be unloaded but they become active every time I load the solution.

Any idea what to do with the issue?

TobiMcNamobi
  • 4,687
  • 3
  • 33
  • 52
Vilém Procházka
  • 1,060
  • 2
  • 17
  • 28

5 Answers5

77

I had similar issues and it usually comes down to the Target Framework (Project>Properties>Application). I was working on a solution using .NET 4.6 and for some reason the default framework for new projects have a different target (in my case it was 4.5.2). So make sure you check all your project at the very least have the same target framework.

MichaelChan
  • 1,808
  • 17
  • 34
7

Do the following:

In vs choose: tools->options->resharper->options-> general-> click the clear caches button.

then close all your opened tabs and shut down vs2013.

finally, start vs2013 again.

Let me know if that worked for you.

DeJaVo
  • 3,091
  • 2
  • 17
  • 32
  • It didn't. I actually do that every time I "fix" the dependencies for the day's session. Except that I disable and enable Resharper from options instead of restarting VS. If I don't do that Resharper still says there are errors in solution and I would have to open every file flagged for the errors to get them cleared. – Vilém Procházka Jun 04 '15 at 08:44
  • I also tried to restart VS with Resharper disabled and it didn't make a difference. – Vilém Procházka Jun 04 '15 at 08:47
  • 1
    What about this:http://stackoverflow.com/questions/9799074/how-to-make-resharper-re-evaluate-its-assembly-reference-highlighting – DeJaVo Jun 04 '15 at 16:54
  • 1
    Nope, didn't help. I have a feeling this is not caused by Resharper. – Vilém Procházka Jun 09 '15 at 16:14
  • 2
    Just to debug the issue please install this vs extension: https://visualstudiogallery.msdn.microsoft.com/bc842a44-0f66-474d-92f1-1342158b154f Set within extension setting to unload the 2 projects. see if it helps. – DeJaVo Jun 09 '15 at 18:36
  • I tried the extension. I don't see a way to set it on per project basis, just solution wide. What happens now is when I set it to "PLP_DemandLoad" the yellow triangles are gone (yay!). The two projects that are supposed to stay unloaded didn't stay that way. If I choose "PLP_LoadIfNeeded" I need to first click on the project I want to load which is ok. The triangles are gone too and the two projects stay unloaded. However for some reason all my Razor @helpers stop working with "cannot resolve symbol." – Vilém Procházka Jun 10 '15 at 15:15
  • Can you verify both unloaded projects target the same .NET framework you've noted (4.5.1), similar cased caused by a specific project targeting a lower .net framework (3.5 etc.) while other target an higher .net. – DeJaVo Jun 10 '15 at 19:21
  • Yes, all my projects are on 4.5.1. And the issue is that they don't stay unloaded. They always become enabled when the solution is loaded. – Vilém Procházka Jun 12 '15 at 10:22
  • Try changing msbuild version in csproj to 12. http://stackoverflow.com/a/26524486/3125120 – DeJaVo Jun 12 '15 at 11:13
  • I had this problem with some of the references in a few projects and this solved the problem for me. – Kelly Cox Oct 04 '17 at 14:36
0

Try switching to managed compatibility mode in VS2013
you can do that by going to tools->options..->General tab and check the Use managed compatibility mode

dev-masih
  • 4,188
  • 3
  • 33
  • 55
0

I had the same thing happen but didn't suspect the 24 warnings I was getting was related to this error: Error 1 Unable to locate the .Net framework aspnet_merge.exe tool on path '~\Photo Archive\Main\etc\tools'. You need to set the msbuild property 'AspnetMergeToolPath' to the folder containing this tool. ODOT.PhotoArchive.Web

Trying to set the MS build property led to a lot of research just to find out WHICH property to set. So, Agent Ransack to the rescue -- searched my drive for the most recent version of the tool and copied it to the directory Visual Studio was complaining about.

Rebuilt the project with the idea of clearing the error but then the 24 warnings also disappeared.

FYI -- this is an MVC project which will replace a classic asp project. This might be peculiar to MVC projects.

At any rate, there was a lot of chasing snipes before this was finally tried. So, where this is happening, try handling any errors no matter how remote the possibility is they're related to the issue.

user1585204
  • 827
  • 1
  • 10
  • 14
0

I had the same problem as you can see in this picture.

enter image description here

Its reason was the hidden folder. I had hidden the folder containing the project files. I got rid of this problem by unchecking the hidden attribute of the root folder containing the project files and restarting the visual studio. Check it once, you might have checked the folder to be hidden.

Elham Kohestani
  • 3,013
  • 3
  • 20
  • 29