VS2010 - The referenced component 'X' could not be found. - Disable auto “add reference”

We have a problem with our project files, which is annoying.

Example:

We have a solution with projX and projY, which reference the assembly log4net.

Say, e.g. somebody moves the assembly file and only updates the reference in projX + then commits without discovering the missing assembly - then the reference goes missing in projY.

The next time I do a checkout and open the solution the projY has the reference correctly marked by VS2010 as missing, with a little exclamation mark. So far so good. :)

Problem:

Now if I do Build of the solution then the assembly reference is magically updated in projY to point to projX's BIN folder! (In this case projX has to be build BEFORE projY)

It appears that VS2010 searches our solution tree and adds the assembly automatically if it can find a matching one.

Nice feature, but also a bit dangerous and very misdirecting. For example the assembly might end up having a path which points to another projects bin folder.

Question:

Is there any way to disable this behaviour and just get a compile error, which prevents the build?

Notes:

  • We shifted to using NuGet recently.
  • We have defined our own output folder -> files are not placed in Bin\Debug but in ..\output.

[EDIT]

Updated the example for more clearity.

[EDIT]

Searching the web for a solution I found this articale which describes a related problem, where VS2010 also auto adds references but from in this case from the GAC. Our assemblies are NOT in the GAC. http://blog.scrappydog.com/2010/07/bug-tfs-2010-outsmarts-itself-and-auto.html

[EDIT]

Tried fixing this using a Reference Path in the project. The idea was that VS would search the Reference Path first and project bin folders second. But no luck. It still takes the assemblies from the output folder.

Answers


No, there is no known workaround about this.


I know this might sound stupid, but have you checked your projects Reference paths defined in the project's properties? Maybe its just picking up the missing reference from whatever paths you might have set up.


I had the same problem with one assembly.

What worked for me was actually moving the whole solution folder to the root of the disk, befor the path to some files was exceeding 256 characters. I learned that when trying to zip/unzip the solution folder.


Need Your Help

Pop from empty list errors

python list loops nested pop

I'm writing a code to pop from a list consisting of 3 nested list.

Resource interpreted as Other but transferred with MIME type undefined. error for IE (Asp.net Website)

c# asp.net download cross-browser

WHen I try to download from Chrome it works fine, but in IE 8 it is not downloading it is showing the error above, protected void btn_ExcelDownload_Click(object sender, EventArgs e) {

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.