在VS2012 c#项目的构建过程中,我一直得到这个错误

Error   41  Could not copy "obj\Debug\WeinGartner.WeinCad.exe" to
 "bin\Debug\WeinGartner.WeinCad.exe". 
 Exceeded retry count of 10. Failed.    


Error   42  Unable to copy file "obj\Debug\WeinGartner.WeinCad.exe" to
"bin\Debug\WeinGartner.WeinCad.exe". The process cannot access the file
'bin\Debug\WeinGartner.WeinCad.exe' because it is being used by another 
process.    

现在我知道该终止进程了

Weingartner.WeinCad.vhost.exe

(有时)有用,但这让我很紧张。有办法阻止这一切发生吗?

调试器设置为


当前回答

另一个拼凑,额,但它很容易,为我在VS 2013工作。单击项目。在属性面板中应该有一个名为Project File的条目,该条目带有一个值

(你的项目名).vbproj

更改项目名称—例如在末尾添加-01。被锁定的原始.zip文件仍然在那里,但不再被引用…这样你的工作才能继续。下次计算机重新启动时,锁将消失,您可以删除错误文件。

其他回答

我在Visual Studio 2013中遇到过类似的错误消息。

大多数情况下,我发现这种情况发生在调试进程因为异常而停止时。

当clean+build不能为我解决这个问题时,我通过以下方法取得了成功:

关闭Visual Studio 删除bin和obj文件夹 重新开放Visual Studio。

此“bug”自Visual Studio 2003以来一直存在。

最后,我还发现我通常可以通过简单地重命名可执行文件然后删除它来克服这个问题。

I experienced the error-messages when attempting to build the primary WinForms (XAF) project. I could only execute the application one time then needed to shutdown the VS2015 IDE and restart before a rebuild could be performed. After some digging in the project's property pages - in the "debug" property page, a check box was selected - Enable the Visual Studio Hosting Process. I unchecked and restarted the IDE, the application is now building without - "unable to copy the {project}.exe" messages.

Visual Studio托管过程的目的是什么?

重置IIS,停止使用您的DLL的服务(可能是控制台应用程序或windows服务托管应用程序或IIS),然后尝试。

这对我很管用。

我在Windows 8上的VS 2012 Version 11.0.60610.01 Update 3上遇到了同样的问题

没有打开设计器窗口,项目是一个简单的控制台应用程序。

删除访问该文件的vshost进程在大多数情况下都不起作用,因为该进程没有访问该文件。

最简单的工作方法是将项目从解决方案中删除,在解决方案中构建另一个项目,然后将原始项目添加回来。

这是一种刺激和浪费时间,但这是我所知道的所有其他选择中最便宜的。

希望这对你有所帮助……

我通过在任务管理器中杀死IISExpress解决了这个问题