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 informa
I also had the same issue. Tried all the suggestions above with no luck. I eventually change the Build Configuration from Debug to Release, the solution built...
Old topic, but something that worked for me. I had 2 projects in my solution, a class library type project and a windows form project. The windows form project was referencing the compiled binary and not the project itself in my case which was causing the lock. After changing the reference to the class library project, it worked properly.
I changed the 'StartUp Project' of my solution to a project without reference to the locked file's project. This solved the issue for me using VS 2010 SP1.
(Process Explorer said msvsmon.exe (started by devenv.exe) locked the pdb file. After changing the startup project the processes msvsmon.exe and .vshost.exe disappeared and so did the file handle.)
Alex Clark, thank you for pointing me in the right direction.
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
If you have multiple instances of VS open, close other instances (apart from the one you are trying to compile) - this may resolve the issue.
To avoid that problem just open the project properties, go to Debug tab an untick "Enable the Visual Studio hosting process"