views:

251

answers:

6

I'm using VS 2008. When ever I make a change in my code and try to compile I get the following error:

Error 7 Unexpected error creating debug information file 'C:\Documents and Settings\jbezanson\My Documents\MyProjects\DispatchBoard\DispatchBoard\obj\Debug\DispatchBoard.PDB' -- 'C:\Documents and Settings\jbezanson\My Documents\MyProjects\DispatchBoard\DispatchBoard\obj\Debug\DispatchBoard.pdb: The process cannot access the file because it is being used by another process. ' DispatchBoard

Using Process Explorer, it is always devenv.exe that is locking the file. If I run in Release mode this does not happen. It started 2 days ago when I started a WPF application, and since then it happens with every application I work on.

The only info I could find from Google was referring to a bug in VS 2003.

Anyone else have this problem? How do I fix it? It is getting very annoying having to kill the file handle every time I want to compile.

A: 

Have you tried closing VS, deleting obj folder then restarting VS?

najmeddine
Yes that works but I get the same error the next time I compile.Everytime I want to compile I have to either kill the handle with Process Explorer or close VS and delete the obj folder. That is not a solution and I have not had this problem until 2 days ago. I have been developing in VS for 5 years.
modernzombie
A: 

Since you say you have it on all applications you work on it sounds like a more global problem. You could try and reinit the vs2008 by writing

devenv.exe /setup

Edit: link to command line options

Anders K.
That command does nothing. I assume you just mean to rerun the installer and repair the install?
modernzombie
Tried this and it didn't work.
modernzombie
You mean it didn't so you got an error message or do just mean it didn't solve your problem?
Anders K.
+1  A: 

When I have problems with locked files, I use Unlocker. (If you tried everything and it's not working, try this ;)

Jodi
At this point, unless anyone else can suggest another solution, this is what I am going to have to use. Unblocker is much better than Process Explorer.
modernzombie
A: 

I have solved a similar problem by adding these lines as a pre-build event:

if exist "$(TargetPath).locked" del "$(TargetPath).locked"
if exist "$(TargetPath)" move "$(TargetPath)" "$(TargetPath).locked"

With proper modifications, it might help your problem.

erikkallen
I saw this solution somewher else and was not able to get it to work.
modernzombie
A: 

I just came across the same problem today. And then I realized what went wrong: I had couple of Visual Studio windows opened at the same time, and one of them was in debug mode.

When I stopped debug mode in that one, the problem was solved.

That happens when you have a "fistfull of VS windows" opened.

Alex Wolf
Thanks for sharing that. In my case, however, I open have one instance of VS open.
modernzombie
A: 

I had the same problem this morning and noticed that I had another project open that had a reference to the one that would not compile or debug. I removed the reference (as I didn't actually need it) and it was fine.

alex350r