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.

一纸荒年 Trace。
2楼-- · 2020-06-30 05:50

Not need to restart or delete the file.Deleting will not be possible , you will get error message. Just rename the file and that is enough. VS2010 will create another file for you as it wont find the origional. :)

3楼-- · 2020-06-30 05:52

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...

The star\"
4楼-- · 2020-06-30 05:53

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.

5楼-- · 2020-06-30 05:53

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.

6楼-- · 2020-06-30 05:55

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

In case of broken link, here's a mirror.

Evening l夕情丶
7楼-- · 2020-06-30 05:56

The only thing that worked for me is to remove the optimizeCompilations="true" attribute from on the compilation element in my Web.Config file.

Compilation time may be a little longer, but it worked well.

登录 后发表回答