4

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 now.

tanascius
  • 53,078
  • 22
  • 114
  • 136
  • 1
    Why are you copying all the resulting DLLs to one output directory? This is likely why you are having the issue in the first place. – Oded Jun 21 '10 at 14:24
  • 1
    Are you using Firefox/Chrome/Safari as your default browser for running your web site? Visual Studio doesn't seem to recognize when these browsers shut down and doesn't terminate the WebDev.WebServer.exe. – Dave White Jun 21 '10 at 14:30
  • 1
    I have had this issue in the past, and it was always, ALWAYS my own program that was the culprit of using the process. Check through your code, make sure any reference to the DLL is properly cleaned up. Also, as a side question, are you using bitmaps in your DLLs? – Brandi Jun 21 '10 at 15:03
  • The solution for me is to stop the IIS Express processes from command line in "Pre-Build Event" https://stackoverflow.com/a/57570301/2736742 – A. Morel Aug 20 '19 at 09:20

1 Answers1

0

Can't you add a build event to clean up the obj folder (umm... that's what you said in the first workaround... but i think it might've been the BIN folder, not the obj) automatically on each build?

CrystyB
  • 23
  • 3