locked
Could not copy DLL - The process cannot access the file because it is being used by another process. RRS feed

  • Question

  • User966057038 posted

    Hello,

    I keep getting this error when I Build and Run my project:

    Warning: Could not copy "obj\Debug\Solution1.dll" to "bin\Solution1.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\Solution1.dll' because it is being used by another process.
    Error: Could not copy "obj\Debug\Solution1.dll" to "bin\Solution1.dll". Exceeded retry count of 10. Failed.
    Error: Unable to copy file "obj\Debug\Solution1.dll" to "bin\Solution1.dll". The process cannot access the file 'bin\Solution1.dll' because it is being used by another process.

    This sometimes happens after a few successful builds, but sometimes on the first build when I launch VS. My workaround so far is to do Build > Clean, then Build and Run again. Or close VS and open it again. Is there a more permanent fix? This thread seems to suggest that it may be a VS bug. Is it?

    Thanks all.

    Wednesday, October 21, 2015 8:29 PM

Answers

  • User-166373564 posted

    Hi,

    Could not copy "obj\Debug\Solution1.dll" to "bin\Solution1.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\Solution1.dll' because it is being used by another process.

    According to the error message above, some process must be using the dll. Generally it's recommended to clean and rebuild your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 

    If this issue is still persisting after the above steps, try restarting Visual Studio (and even your local machine).

    Regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 26, 2015 1:52 AM
  • User753101303 posted

    Hi,

    Do you run your app locally first? You could perhaps try a tool such as https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx to first see who opens this file (VS, IIS, an antivirus sotfware or whatever...)

    If I remember I had this previously (VS 2010 maybe) but not recently (using still mostly VS 2012 Update 4).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 26, 2015 12:04 PM

All replies

  • User-166373564 posted

    Hi,

    Could not copy "obj\Debug\Solution1.dll" to "bin\Solution1.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'bin\Solution1.dll' because it is being used by another process.

    According to the error message above, some process must be using the dll. Generally it's recommended to clean and rebuild your current Project (Right-click > Clean, Right-click Rebuild respective) and see if that makes any difference at all. 

    If this issue is still persisting after the above steps, try restarting Visual Studio (and even your local machine).

    Regards,

    Angie

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 26, 2015 1:52 AM
  • User966057038 posted
    Thanks Angie for the reply. Yes your approach works but the problem comes back again when I do a build. Anyway to fix this permanently?
    Monday, October 26, 2015 5:48 AM
  • User753101303 posted

    Hi,

    Do you run your app locally first? You could perhaps try a tool such as https://technet.microsoft.com/en-us/sysinternals/bb896655.aspx to first see who opens this file (VS, IIS, an antivirus sotfware or whatever...)

    If I remember I had this previously (VS 2010 maybe) but not recently (using still mostly VS 2012 Update 4).

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 26, 2015 12:04 PM