在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
(有时)有用,但这让我很紧张。有办法阻止这一切发生吗?
调试器设置为
我在Windows 8上的VS 2012 Version 11.0.60610.01 Update 3上遇到了同样的问题
没有打开设计器窗口,项目是一个简单的控制台应用程序。
删除访问该文件的vshost进程在大多数情况下都不起作用,因为该进程没有访问该文件。
最简单的工作方法是将项目从解决方案中删除,在解决方案中构建另一个项目,然后将原始项目添加回来。
这是一种刺激和浪费时间,但这是我所知道的所有其他选择中最便宜的。
希望这对你有所帮助……
异常
在某些情况下,在Visual Studio当你(Build || Rebuild)在上面
运行IISExpress时,你会遇到这个异常:
无法复制文件"obj\Debug\YourProjectName.dll"到bin\YourProjectName.dll"。进程无法访问该文件
'bin\YourProjectName.dll',因为它正在被其他人使用
过程
解决方案
右键单击需要构建的web项目。
单击属性。
在左侧选择Build Events选项卡。
在Pre-build events命令行中粘贴这两行:
tasklist /fi “imagename eq iisexpress.exe” |find “:” > NUL
如果错误级别 1 任务杀死 /f /im “iisexpress.exe”
你很好!