开发者

Getting "cannot copy assembly" errors when trying to build website

开发者 https://www.devze.com 2022-12-21 11:47 出处:网络
I\'m getting two of these errors when trying to build the full solution for our website.Here\'s the full text of the errors:

I'm getting two of these errors when trying to build the full solution for our website. Here's the full text of the errors:

Error 91 Cannot copy assembly 'Emcom.DataAccess.dll' to file 'C:\work\evan-moor.com-trunk\2007.evan-moor.com\Bin\Emcom.DataAccess.dll'. Unable to add 'C:\work\evan-moor.com-development\Emcom.DataAccess\bin\Debug\Emcom.DataAccess.dll' to the Web site. Unable to add file 'Bin\Emcom.DataAccess.dll'. The process cannot access the file because it is being used by another process.

C:...\2007.evan-moor.com\

Error 92 Cannot copy assembly 'Emcom.DataAccess.Generated.dll' to file 'C:\work\evan-moor.com-trunk\2007.evan-moor.com\Bin\Emcom.DataAccess.Generated.dll'. Unable to add 'C:\work\evan-moor.com-development\Emcom.DataAccess\bin\Debug\Emcom.DataAccess.Generated.dll' to the Web site. Unable to add file 'Bin\Emcom.DataAccess.Generated.dll'. The process cannot access the file because it is being used by another process.

C:...\2007.evan-moor.com\

I've done everything I can think of short of reinstalling Visual Studio to try and fix this and nothing works. One of my co-workers also gets these errors, but another one does not. I suspect one of us might have done a merge incorrectly to cause this given that it's referring to the development folder in here while I'm trying to b开发者_如何学Gouild the solution of the trunk.

I've checked and double checked all the dlls, and the two projects referenced here and neither of them are using the development folder, which I suspected might have caused this. I also did a clean brand new checkout of our trunk, and still got these errors. Then I tried deleting all the .NET temporary files to solve it, and still no luck. I did a google search for this issue and found a Microsoft hotfix for the problem which involved replacing a dll - but that was for Visual Studio 2003, and I'm using 2008. The dll in question on my computer is two full versions newer than the replacement version they list in the hotfix, so I'm not sure it'd be a good idea to replace what I've got with what's mentioned there.

Any ideas? Short of reinstalling Visual Studio and reformatting my computer, I'm out of ideas. Reinstalling might do it, but reformatting would be too much work just to fix this bug.


You could give "WhoLockMe" a try. It is an addin for windows explorer and is available from teh context menu. Navigate to the dll, use the utility and if it reports an locks there is a kill process function available.

Download from http://www.dr-hoiby.com/WhoLockMe/

Instructions for use are available on the same web site.


I thought I'd answer this in case anyone else is having this problem as well. One of my coworkers ended up solving this problem for me. It ended up being an issue of an incorrect build order, which he fixed by moving project references around to correct the build order. One project was dependent on another project, and was being built before the project it was dependent upon. Once he fixed this, the problem went away.


I'm having the same problem in VS 2010, and also had it in earlier versions and it seems to continue to be a bug with the IDE. Exiting the IDE used to help it go away but that only works at times in VS 2010. Look at this Microsoft Support page for details http://support.microsoft.com/kb/887818

When you try to build a Microsoft Visual C# .NET solution in Microsoft Visual Studio .NET 2003, the solution build operation fails. You may receive an error message that is similar to the following:

Cannot copy assembly to file \bin\Debug\Release\.dll. The process cannot access the file because it is being used by another process.

Note Typically, this problem does not occur after you restart Visual Studio .NET 2003.

I also tried these two other suggestions but none worked for me: http://forums.asp.net/t/1288310.aspx

Correction: This first suggestion worked for me; I had commented the line hostingEnvironment shadowCopyBinAssemblies="false" in the web.config of another project, not in the project the error is referring to. After doing it in the right place the errors are gone.

One

My team found the resolution to our problem with the build of our web site this morning. Someone had put this entry into the web config files. hostingEnvironment shadowCopyBinAssemblies="false" if you have this entry in any machine config or web config it will cause this issue.

Two

You need to delete hash.web file, Open C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\YourWebSite, then Serach hash.web and Delete all these file and then rebuild. Here the explaination of, hash.web
http://blogs.msdn.com/tmarq/archive/2007/11/02/asp-net-file-change-notifications-exactly-which-files-and-directories-are-monitored.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号