VS2010-找不到引用的组件“X”。-禁用自动“添加引用”

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.

#0

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.

#1

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.

#2

No, there is no known workaround about this.

#3

Have you confirmed this with other assemblies? I haven't used log4net before but if it is in the Global Assembly Cache (GAC) with the right version it could be picked up from there. The GAC is a location for system-wide assemblies to go to be referenced by applications on the system.

推荐文章

瞬态标记模式永久开启

瞬态标记模式永久开启

推荐文章

媒体文件中的DTD问题

媒体文件中的DTD问题

推荐文章

LINQ-to-SQL中的投影

LINQ-to-SQL中的投影

推荐文章

Xcode-在我的应用程序中添加网络错误警报代码?

Xcode-在我的应用程序中添加网络错误警报代码?

推荐文章

Haskell的全功能CSV解析器?

Haskell的全功能CSV解析器?

推荐文章

Opengl ES-有没有办法加快我的渲染速度?

Opengl ES-有没有办法加快我的渲染速度?

推荐文章

在XHR中将多部分/表单数据用作内容类型时获取“400错误请求”

在XHR中将多部分/表单数据用作内容类型时获取“400错误请求”

推荐文章

我可以用sqlite替代本地php功能而不影响性能吗?

我可以用sqlite替代本地php功能而不影响性能吗?

推荐文章

Rails mass assignment和Backbone.js

Rails mass assignment和Backbone.js

推荐文章

Haskell:在连续传递样式中完全定义阶乘的问题

Haskell:在连续传递样式中完全定义阶乘的问题

推荐文章

fbgraph:true:TrueClass的未定义方法“encode_json”

fbgraph:true:TrueClass的未定义方法“encode_json”

推荐文章

开源PHP购物车库?

开源PHP购物车库?

推荐文章

Winform和ASP.NET中是否存在等效的WPF OriginalSource事件属性?

Winform和ASP.NET中是否存在等效的WPF OriginalSource事件属性?

推荐文章

JAVA-是否有用于客户机-服务器交互/连接的日志/任何文件?

JAVA-是否有用于客户机-服务器交互/连接的日志/任何文件?

推荐文章

在滚动视图上检测PinchGesture端

在滚动视图上检测PinchGesture端

推荐文章

jQuery BlockUI中的登录按钮

jQuery BlockUI中的登录按钮