Visual Studio 无法写入输出文件“...objDebugFoo.Bar.dll" [英] Visual Studio Could not write to output file '...objDebugFoo.Bar.dll"

查看:22
本文介绍了Visual Studio 无法写入输出文件“...objDebugFoo.Bar.dll"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Visual Studio 2010 中编译大型 c# 解决方案时遇到此错误.每次编译后,我都必须删除该解决方案使用的项目之一的 obj 文件夹.否则我会收到以下错误:

I've got this error while compiling a big c# solution in Visual Studio 2010. Each time after compilation I had to delete obj folder of one the projects used by this solution. Otherwise I got the following error:

Could not write to output file '...objDebugFoo.Bar.dll'
The process cannot access the file because it is being used by another process

我一直在互联网上寻找解决方案,但实际上找到/尝试了其中的几个.

I've was looking for a solution all over the Internet and actually found/tried few of them.

例如:开发论坛上的很多人都建议不要在UserControl(在其他一些来源来自)设计器打开时开始编译.

For example : a lot of people on dev forums were suggesting not to start the compilation while UserControl (in some other sources From) designer is opened.

其他一些人使用预构建脚本来删除 obj 文件夹,这种特殊的解决方案是可以接受的,但是如果发布的项目是一个广泛使用的库,它的重新编译将导致父"项目的重新编译.

Some other people used pre-build scripts for obj folder removal, this particular solution is acceptable, but if the issued project is a widely used library its recompilation will cause recompilation of "parent" projects.

推荐答案

我终于找到了解决这个 VS2010(也是 SP1)bug"的解决方案,我想与 stackoverflow 用户分享.

Finally I've discovered a solution for this VS2010 (SP1 too) "bug" and I want to share it with stackoverflow users.

就我而言,问题是 csproj 文件是自引用锁定的 '...objDebugFoo.Bar.dll' 文件.疯了我知道.所以我通过从 .csproj 文件中删除以下行来解决这个烦人的问题:

In my case the problem was that csproj file was SELF-REFERENCING the locked '...objDebugFoo.Bar.dll' file. Crazy I know. So I solved this annoying issue by removing the following line from .csproj file:

<Reference Include="Foo.Bar">
  <HintPath>objDebugFoo.Bar.dll</HintPath>
</Reference>

这篇关于Visual Studio 无法写入输出文件“...objDebugFoo.Bar.dll"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆