Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2012 warning MSB3026: Could not copy DLL files

I keep getting:

warning MSB3026: Could not copy dlls errors.

I have several projects in the solution.

On build, I also get the error:

Error 47 Could not copy "myapp\bin\Debug*.dll" to "bin*.dll". Exceeded retry count of 10. Failed.

The application just stops responding in the middle of debugging, and I have to close Visual Studio every time. Which was annoying, but now it's getting frustrating as well.

We are eight team members, and all of us are getting the same error. We can't rebuild the solution, and the application is running very slow.

One of things we are using in the project is SignalR.

These are the things I have tried so far. They didn't help me, but they might help the reader:

  1. I have tried solutions described in Visual Studio debugging/loading very slow, but that didn't work.

  2. I have also tried unchecking Enable the Visual Studio hosting process in each project properties and that didn't fix the issue either.

  3. Solutions are described in http://www.richard-banks.org/2008/04/how-to-fix-problems-with-locked-files.html and http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/40ed753e-47af-4638-8a72-1d607102a05c/

  4. Pre-build scripts on the projects: if exist "$(TargetPath).locked" del "$(TargetPath).locked" if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"

  5. The bin folders are not under source control.

  6. Sometimes killing the Microsoft.VisualStudio.Web.Host.exe process releases the lock on the files, but this does not always work.

  7. I am running Visual Studio in administrator mode.

  8. I have full access (permissions read/write) on the source code folders.

like image 666
Oxon Avatar asked Mar 28 '13 18:03

Oxon


People also ask

Could not copy the file .pdb because it was not found?

I suggest you delete the previous output path like bin/debug or release, and then re-open the project file, clean and rebuild the solution with the new output path, check it again. (3) I also met this kind of issue which was related to the post-build event, so you need to check it in your side.

How do I debug a referenced DLL in Visual Studio?

Debug from the DLL project Set breakpoints in the DLL project. Right-click the DLL project and choose Set as Startup Project. Make sure the Solutions Configuration field is set to Debug. Press F5, click the green Start arrow, or select Debug > Start Debugging.


2 Answers

This is generally a permissions issue with your bin directory. Navigate to it in Windows Explorer and make sure readonly is off. If you get an error changing the read status of the directory, make sure you're running on an administrator-level account or elevate accordingly. Once write permissions are re-enabled, your build should work fine.

like image 189
Chris Pratt Avatar answered Sep 19 '22 20:09

Chris Pratt


Clean Solution, then Rebuild Solution fixed this issue for me.
The first time I tried to perform a Clean, I got an access violation error.
To remedy that, I exited VS, manually deleted the bin folder, and opened it back up. Then I could perform the Clean.

This had nothing to do with permissions or access level.
Ensuring the output directory was not read-only and running VS as Admin did not help.

Please refer to Visual Studio “Could not copy” … during build.

like image 24
Scott Solmer Avatar answered Sep 18 '22 20:09

Scott Solmer