Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 Randomly reporting: "The referenced component X could not be found"

I recently migrated and re-tartgeted a solution from VS 2010 and .NET 4.0 to VS 2012 and .NET 4.5. However now all of a sudden and randomly VS 2012 reports almost all cross-project references as:

"The referenced component X could not be found" (warning)

Now, I know for a fact that this is not correct. Firstly because I can see the assembly in the directory set for the assembly reference and secondly because when I bring up the "Add Reference" dialog the warning suddenly goes away and so do the yellow warning icons on the assembly reference

Doing a full rebuild clears the warning and then it will stay that way for a while and then randomly the same warnings show again.

Has anyone seen this? What can be the cause and how can I fix it?

Edit: I was not seeing this weird behaviour in VS 2010

Edit: The warnings are reported for references to other projects in the same solution.

like image 796
Ivan Zlatev Avatar asked Aug 23 '12 15:08

Ivan Zlatev


3 Answers

It is caused by parallel build. Setting "maximum number of parallel project builds" to 1 will resolve the issue.

See also: http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/a9ac83eb-14b3-4bd2-bc51-7c2ae7363c46

like image 124
Petr Altman Avatar answered Nov 13 '22 06:11

Petr Altman


I just had similar issue with 31 projects and it turned out to be framework version mismatch - you should check framework version dependencies.

In my case, 4.0 library failed to build because it was dependent on 4.5 libraries and it was failing to resolve types from the 4.5 libraries.

like image 24
pgk Avatar answered Nov 13 '22 07:11

pgk


Seen this behaviour sometimes in VS 2008, and 2010 after project version upgrade. Usually removing and adding references again fixes issues.

like image 2
Petr Abdulin Avatar answered Nov 13 '22 05:11

Petr Abdulin