Unable to copy file

Category: visual studio diagnostics

Question

jjhii on Fri, 18 Jun 2010 12:59:12


I am not sure this is the correct forum but here goes.

I have one very big project that keeps giving me a "Unable to copy file '...', being used by another process" error.  This is every time I press F5 to debug.  Closing the project an opening fixes the problem but is very time consuming.

1) I have seen the thing about pre-build where you copy the exe file to something like *.lock, this only works once and normally the error just moves to a related dll file so I still have to restart.

2) Assuming it is my fault I have traped the ApplicationExit in program file to verify all my threads have ended.  There are the three "no name" threads which seem to have to to with debugging and then my two which end as far as I can tell correctly.  Is there another way of testing, this was not a problem with 2008.

3) I tried the system internal tools to see what was holding the exe file and it is devenv to that does not tell me anything.

4) I have tried killing name.vhost.exe in task explorer but that does not help.  I don't seem to have another copy of my application running so?

5) I have tried this on my main computer with VS2010 pro and now the trail version of VS2010 Ult, the second is worse than the first.  With the pro on my main system it happens less frequently (no clue why). (main system Vista pro 32, laptop Windows 7 bus 64)

6) I have removed the program from source control, seem to remember someone mentioning that but it does not affect anything.

7) this is a forms project in C# not WPF, the other WPF projects don't seem to have the problem, maybe that is a hint.

8) I have tried running as anycode and x86, no change.

9) At least one time I canceled the build and I had to restart because of of the copy project and the program had never started.

10) I have stopped the application on the first line of code in program.cs and then stopped the debugger, I still have to restart because of copy error.  None of my code every started so it can't be a error in my code.

Suggestions, comment?

Replies

jjhii on Fri, 18 Jun 2010 13:45:16


I think I may have finally gotten it, yi gads!

As I said before I removed from source control, did not help.  So I deleted all the ".scc" files, did not help.  I then deleted all the ".csproj.vspscc" files and now it is working, well 6 times in a row, crossing my fingers...

RAT_SL on Tue, 08 Oct 2019 14:27:30


Hi,

Please try one of these steps.

1) Open command prompt as administrator and then run this command > taskkill /F /IM VBCSCompiler.exe

2) Turn on windows service :- Application experience > Computer (right-click) -> manage -> Service & Application -> service -> Application experience -> Enable  and Set as Automatic -> Start Service 

(O_O) Happy Coding>>//