Share via


Unable to copy file "obj\Debug\Project.dll" to "bin\Project.dll"

Question

Tuesday, July 1, 2008 4:33 AM

Hi. This is really flustrating. When i compile my WebApplication, it works normally. But when i do refresh in browser, than IIS somehow "locks" that dll file and another compilation ends with this error:

Unable to copy file "obj\Debug\Project.dll" to "bin\Project.dll". The process cannot access the file 'bin\Project.dll' because it is being used by another process.

After restarting application pool in IIS, it's released and i can compile in standard way. I tried use handler.exe from sysinternals and it shows, that w3wp.exe process is using that dll. It's very time consuming before every compilation restart IIS. Any ideas where can be a problem please ?

Microsoft Windows Server 2003 Standard Edition SP2
IIS 6.0 

Microsoft Visual Studio 2005 Professional
Version 8.0.50727.762  (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP1
Microsoft Web Application Projects 2005
Version 8.0.50727.762
Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1 (KB926601)

All replies (9)

Monday, July 7, 2008 4:14 AM âś…Answered

That is most closer to the problem, however after today restarting of computer it works without any problem. So i guess it was something wrong in the IIS (or somewhere else in the system) which caused locking dll. Thanks everyone for help even it was solved by restart.


Thursday, July 3, 2008 3:21 AM

Hiya,

 Check out this KB http://support.microsoft.com/kb/311491/

Cheers

Jorus


Thursday, July 3, 2008 11:40 AM

Thanks but that's not that case. Respectively i know that dll is locked by IIS Application Pool, but i don't know why and how to resolve this. I was trying figure out how to restart app pool from command line for pre-build steps, but i had no luck. I found only how to recycle pool, but that not solved issue. So i'm using "iisreset" in pre-build. It takes longer to restart whole IIS, but i don't need to manully reset pool before each compilation, which was main point of flustration. But some better solution would be nice...


Friday, July 4, 2008 8:14 AM

Hi,

Based on my understanding, IIS hangs when you try to refresh the page. If I have misunderstood you, please feel free to let me know.

To better understand your issue, please confirm the following information:

  • If we create a simple test project and refresh the page, does it have the same issue?
  • I guess some exception occurs in the IIS when you refresh page so that the IIS hangs and your application is locked by IIS process.

 

In this case, a log will be very useful for the trouble-shooting. You can consider Windows Event Viewer which records the error of the applications.

 

I hope this helps.


Friday, July 4, 2008 11:57 AM

 Well no, IIS doesn't hangs up. I have got that error message (from first post) when i compile project after refresh in browser so binary is loaded into IIS application pool and stays there "locked". I must then restart application pool to free that binary and then i can make successful compilation. Obviously no exception is thrown, it's compilation error. Event log doesn't contains anything, because it seems normal to the system.


Friday, July 4, 2008 12:50 PM

may be the link can help u

http://support.microsoft.com/kb/313512

http://blogs.msdn.com/shaykatc/archive/2005/05/05/415120.aspx

hope this helps


Thursday, June 3, 2010 10:39 AM

Till Date, I find no solution to the problem below.

Unable to copy file "obj\Debug\Tax2010.dll" to "bin\Tax2010.dll". The process cannot access the file 'bin\Tax2010.dll'

because it is being used by another process. 

In my case, I have two projects under one Solution named "Tax2010"

1) Calc and Calc.DLL (contains .cs class files)

2) Tax2010 and Tax2010.DLL (contain .aspx pages along with respective .cs files and other .cs class files)

I have configured both the projects in a way that their respective .dll be copied to one common bin directory placed under
Tax2010 directory.

Here is the genral hierarchy of the project.....

Tax2010
   Tax2010
 Bin
   Tax2010.DLL
   Calc.DLL
 UI
   ....aspx
   ....cs
 CL
   ....cs
   ....cs 
   Calc 
        AK
   ....cs
   ....cs

The problem happens whenever I make any changes to .cs file and try to build the project.One interesting thing to note,

though, is that I am not running the application through IIS. Its using WebDev.WebServer.Exe. How I am dealing with it right

now ?

  1. Delete the obj folder and build the peoject. It works fine
    or
  2. CTRL + ALT + DEL - > Task Manager -> Processes -> WebDev.WebServer.Exe - > End Process.

Now I am sick and tired of doing this monotonous job. Please somebody come up with some wow solution. Enough is Enough

I


Wednesday, October 20, 2010 7:36 AM

I had a very similar problem.

The cause was that the two projects where targeting different .net framework versions (2 & 3.5 in my case.)

When I changed both to target .net 2 framework (project properties - compile tab - Advanced compile options - Target Framework) it all worked fine.

Was using vs2010


Thursday, March 17, 2011 12:33 AM

hi, The problem is due to the Framework Version. If you have multiple projects, you must ensure that all the porjects using same Framework version. (Probably Framework 4.0, if you use VS2010).  To check/Change, go to Project Properties -> Application. If you use any Web Service Reference, you must clear/remove and recreate once again. This should resolve your problem.