Visual Studio 2010 Build Fails to File Copy Error

半城伤御伤魂 提交于 2019-12-06 00:42:21

问题


I'm building a project in Visual Studio 2010 and the build fails because it cannot copy the assemblyname.dll file from obj to bin folder. The exact error message is:

Error 7 Unable to copy file "obj\Debug\AssemblyName.dll" to "bin\AssemblyName.dll". The requested operation cannot be performed on a file with a user-mapped section open.

I think this is because the previous file in bin-folder is not accessible. When I try to delete the file manually, I get an error "The action can't be completed because the file is open in another program". If I try to see what application locks the file with Unlocker, I don't get any results (No Locking handle found).

If I restart Visual Studio, the error goes away but happens again after a build or two. Goes without saying that this is seriously slowing me down. Any advice how to start solving this?


回答1:


VIsual Studio 2012 on Windows 8. I was receiving the same error message on my project. Restarting Visual Studio or cleaning the obj folder manually did not help. Finally I closed all open files (Windows -> Close All Documents) and the problem went away.




回答2:


This behavior was due to a newly installed Visual Studio extension called Visual Studio Achievements (http://visualstudiogallery.msdn.microsoft.com/bc7a433b-b594-48d4-bba2-a2f24774d02f)

I noticed that the .pdb file was locked by FxCop (using Unlocker) and I think that the Achievements -extension uses it. After disabling the extension I've no longer got the error mentioned above.




回答3:


This bug has been fixed in recent versions of the extension (>1.7). It was released as a beta, btw...




回答4:


This behavior of VS happen very often even on my computer (and on computers of my coworkers).

In my experience it happen more frequently when:

  • I have some form opened in design when i compile
  • I stop the execution od the application by pressing the "stop" button in VS instead of exiting the application

So, closing the form in design before compile, and exiting the application instead of stopping it, somewhat mitigate the issue... but it still happen :-|

My computer is Win 7 x64 SP1 with VS 2010 SP1, 8Gb ram, and no swap file




回答5:


Platform: Windows 8 Pro, Visual Studio 2012

I found that I receive this error when I am accessing the folder in Windows Explorer.

I was creating PDF documents with Visual Studio 2012. To review the sample document I would right click in Solution Explorer and use Open Folder in File Explorer.

On Windows 7 I would get a SYSTEM.IO error if the actual PDF document was open in Adobe Reader which is expected. With Windows 8 I found that I receive the above error if I have the folder open. I suspect there is a conflict with the Windows 8 preview.

If I close the folder and run the program it works fine.



来源:https://stackoverflow.com/questions/9108306/visual-studio-2010-build-fails-to-file-copy-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!