locked
Error Building Test Project in VS2010 RRS feed

  • Question

  • Here is the error from the VS2010 build output window (targeting .Net 4).

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(3001,9):
    error MSB3021: Unable to copy file "C:\[ProjectDirectoryHere]\[AssemblyNameHere].dll" to "bin\Debug\[AssemblyNameHere].dll". The process cannot access the file 'bin\Debug\[AssemblyNameHere].dll' because it is being used by another process.

    Using process explorer, I can see that the only process holding a lock on the file is devenv.exe.  I am usually able to build the project once before having to restart visual studio (and sometimes after restart, the file is still locked by dev.env)

    It occurs for a small unit test project that references a few assemblies including one large (>10MB compiled C# dll) that happens to be a signed assembly.      I could not reproduce this by starting fresh and gradually adding elements to make it similar to the case I have where it consistently fails. 

    Any help is appreciated.  Let me know what additional information is needed to troubleshoot this issue.

    -Dan

    Tuesday, July 6, 2010 8:46 PM

Answers

All replies

  • I have the same Error in my on my build server.
    Wednesday, July 21, 2010 6:59 AM
  • Daniel-

     

    There is a known bug with regard to the Virtual Host exe locking project output.  IE, we couldn't run tests because our EXE couldn't be recompiled.  

     

    Details:  http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/cea5e4b2-5b33-453c-bffb-8da9f1a1fa4a

     

    Best,

    Craig

     

    Monday, July 26, 2010 6:09 PM
  • None of teh solution posted in the attached thread worked for me with respect to Unit Test...

    For me the issue came when i execute the Unit test project "Run Test" while the "Debug Test" doesn't cause such issue.

    None of the above workaround solved my problem except for killing the Test agent process.

    Used the below command in pre-build event of test project

    taskkill /f /im QTAgent32.exe

    • Proposed as answer by AustinAjit Saturday, April 28, 2012 8:46 AM
    Saturday, April 28, 2012 8:45 AM