1

When I run my solution for the second time, this error appears:

Error 467 Unable to copy file "obj\x86\Debug\uil.dll" to "bin\x86\Debug\uil.dll". The process cannot access the file 'bin\x86\Debug\uil.dll' because it is being used by another process.

For work I need to close and reopen the solution.

Gileno Filho
  • 156
  • 2
  • 6
  • 1
    Duplicate of http://stackoverflow.com/questions/2690119/visualstudio2010-debugging-the-process-cannot-access-the-file-because-it-i – Dervall Apr 17 '12 at 18:34
  • Reply to this topic did not work for me – Gileno Filho Apr 17 '12 at 19:07
  • I added the code: `if exist "$(TargetPath).locked" del "$(TargetPath).locked" if exist "$(TargetPath)" if not exist "$(TargetPath).locked" move "$(TargetPath)" "$(TargetPath).locked"` In Pre-Build - Build Events configuration - and the error no longer appears. – Gileno Filho Apr 17 '12 at 19:08
  • Did you check the answers to all of the other duplicate questions? There's a list of them a mile long in the "Related" sidebar. You can tell because they have the same title. Basically, this is a bug that's been known for a long time, but there's no good solution and it's difficult to reproduce reliably. Microsoft has thought they've fixed it each time with each new version of VS, but it keeps coming back. – Cody Gray - on strike Apr 18 '12 at 00:56

3 Answers3

0

Are you sure you are stoping running instances of your application? You need to stop the application you are developing (debugging or release mode) to start debugging.

Mert Akcakaya
  • 3,109
  • 2
  • 31
  • 42
0
  1. Check to make sure your application still running in Task manager, if yes, kill it.
  2. Disable 'Visual Studio Hosting process' from project properties.
Cinchoo
  • 6,088
  • 2
  • 19
  • 34
0

I've found a bug in VS2010, regarding solutions that reference multiple projects in which you have at least one WPF control library. When you open the WPF designer, the DLL's referenced by the project are locked. Therefore, trying to compile will issue that error.

If this is the scenario you are suffering, there's no solution AFAIK, but as workaround: 1. Make sure to close ALL the WPF open designers 2. Make a rebuild all, then clean solution, then build again. This works most of the time

Or, open the XAML files in XML editor in VS2010, so the designer is not loaded. I usually write XAML directly. If you have to write a more complex XAML, then open Blend side-by-side with VS2010, so you edit XAML in Blend and compile and debug in VS2010.

Haplo
  • 1,368
  • 9
  • 18