Unable to copy file. The process cannot access the file because it is being used by

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajibdotnet
    New Member
    • Jun 2010
    • 1

    Unable to copy file. The process cannot access the file because it is being used by

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

    Unable to copy file "obj\Debug\Tax2 010.dll" to "bin\Tax2010.dl l". The process cannot access the file 'bin\Tax2010.dl l' 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.WebServe r.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.WebServe r.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.
  • Christian Binder
    Recognized Expert New Member
    • Jan 2008
    • 218

    #2
    You say, you copy your dll in a common folder.
    So if project A runs (references the B-dll) and project B gets compiled, it cannot replace the B-dll because it's currently being used.

    I've got some kind of these problems too. There are two approaches, which I have used. First is building a program which cancells the process (like what you described in your 2nd way though programmaticall y). So you can make a shortcut to it. Another approach is, saving your common dlls in an Network Drive, which is bound to a local directory e.g. \\localhost\C$\ MyFolder\ and use detach/attach-scripts. Because it's possible to detach a folder whicih contains a currently used file.

    Comment

    Working...