无法复制" obj \ Debug \ {project} .dll" to" bin \ {project} .dll"

时间:2014-05-06 19:39:24

标签: visual-studio windows-8 visual-studio-2013

当我尝试运行我的项目时,Visual Studio Express 2013 for web一直在抛出这个错误,我发现的唯一解决方案是退出并重新启动Visual Studio或(有时)完全重启Windows。什么可能导致这样的事情?

完整错误转储

Error   19  Could not copy "obj\Debug\HobbsEventsMobile.dll" to "bin\HobbsEventsMobile.dll". Exceeded retry count of 10. Failed.    HobbsEventsMobile
Error   20  Unable to copy file "obj\Debug\HobbsEventsMobile.dll" to "bin\HobbsEventsMobile.dll". The process cannot access the file 'bin\HobbsEventsMobile.dll' because it is being used by another process.   HobbsEventsMobile

4 个答案:

答案 0 :(得分:5)

通过转到项目属性在项目中创建预构建操作(右键单击解决方案资源管理器中的项目,然后选择“属性”选项),选择“构建事件”选项卡。添加以下代码:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

https://social.msdn.microsoft.com/Forums/en-US/5b71eb06-5047-483d-8fd3-b75c102d41e9/unable-to-copy-from-objdebug-to-bindebug?forum=Vsexpressinstall&prof=required

答案 1 :(得分:4)

1 - 选择您的项目

2 - 从视图选择属性页面

进入查看

3-make确保输出路径为空

enter image description here

答案 2 :(得分:3)

线索似乎出现在错误消息中:

cannot access the file 'bin\HobbsEventsMobile.dll' because it is being used by another process

我猜想dll仍然在以前的调试会话中使用。你可以杀死拥有它的进程吗?如果您不确定哪个进程在{d}名称上运行Process Explorer并执行Find,则会显示仍然打开dll的进程。

另一个疯狂猜测:您是否使用Ctrl-F5在调试器外部运行?如果是这样,那么这也可以解释为什么dll仍在使用中。

答案 3 :(得分:1)

您也可以制作干净的解决方案,然后在再次购买之前,检查调试文件夹是否仍然存在.dll文件。如果干净的解决方案不起作用,您可以尝试更改文件名并构建解决方案。您将看到这些错误消失。