Error Creating Debug Information - Code Won't

2020-06-30 05:30发布

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.

19条回答
做自己的国王
2楼-- · 2020-06-30 06:08

This works for me with web projects in Visual Studio Express 2012 for Web:

  1. Press F5 to begin debugging
  2. "Do you want to execute last successful build?" - hit YES
  3. At this point you could try a request - not sure if this step is necessary
  4. Hit the stop button
  5. Recompile successfully
查看更多
一纸荒年 Trace。
3楼-- · 2020-06-30 06:08

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

查看更多
走好不送
4楼-- · 2020-06-30 06:10

This worked for me. What I done was that close my visual studio and delete the .suo file and then re-open the solution. The locking should be disappeared now. Cheers.

查看更多
男人必须洒脱
5楼-- · 2020-06-30 06:12

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.

查看更多
We Are One
6楼-- · 2020-06-30 06:16

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.

查看更多
Melony?
7楼-- · 2020-06-30 06:16

This problem started occurring for me after changing from Cassini to IIS Express as my platform for debugging.

Cassini was much better than IIS Express but doesn't properly support the Integrated pipeline. IIS Express is hopeless.

This seems to be some sort of race condition in Visual Studio or IIS Express. It is nothing to do with one project locking another project - the locks are coming solely from the activity of the web application's build process.

Anyways, none of the above solutions worked for me. Unlocker doesn't seem to be supported for Windows 8 anymore. So instead I tried LockHunter. What I do is keep the LockHunter app open all day. If I get a complaint about some file being locked I copy and paste the file path into LockHunter then try again. This usually sorts out the problem but sometimes takes a few attempts.

查看更多
登录 后发表回答