none
Error: Unable to copy file ... to ... The process cannot access the file

    Question

  • Hello,

    I am using Visual Studio 2005 to develop a Desktop application with C#. I have a solution with 10-15 proyects, and sometimes, when I try to run the application I get this error:

    "Unable to copy file "C:\DataSet\bin\Debug\DataSets.dll" to "bin\Debug\DataSets.dll". The process cannot access the file 'bin\Debug\DataSets.dll' because it is being used by another process.

    The only way I found to solve this problem is by restarting Visual Studio. The dll is not always the same (the project generating the problem usually changes)

    I am working in a group of 20 developers, and we *randomically* get the error.

    Does anyone know how to solve this?

    Thanks,

    Helena.

    Friday, January 19, 2007 6:14 PM

All replies

  • Hi,

    I'm trying to solve the same problem right now. All i can tell you is that i have

    <hostingEnvironment shadowCopyBinAssemblies="false" />

    in my webcofig, and that i rebuild the project that refers to the 'problem dll' when i get this error. It is beter than restarting VS but still no solution.

    (Rebuilding is only available via rightclicking on project)

    Tuesday, January 30, 2007 8:52 AM
  • I get the same error again and again. Rebuilding does not fix the problem have to shutdown visual studio each time...
    Thursday, March 01, 2007 10:14 PM

  • We've had this problem with Studio 2005 from the outset.

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

    Disabling Visual Studio hosting doesn't fix it, neither does setting the <GenerateResourceNeverLockTypeAssemblies> project property.

    At least for me, it appears to be related to particular solutions when they are set as the Startup Project.  I can work around the problem by setting another project as the Startup, then building and launching the debugger from the context menu for the project I'm building/debugging.


     

    Thursday, March 15, 2007 3:48 PM