views:

1747

answers:

8

For some reason this error started popping up today on one of my projects.

Error 1 Unable to write to output file 'C:\MyProject\Release\MyProject.pdb': Unspecified error

If I go into advanced compile options and change it to not generate and debug info, my project compiles fine.

I have tried setting the permissions on the Release folder to full for everyone, so I would assume it's not a permissions issue. Also, I don't see anything in my log files that would provide me with more information about the issue.

Does anyone know why this error would just start showing up or a way to fix it?

Thanks.


Update: I have rebooted my machine, restarted VS several times and have even completely deleted the existing OBJ file where the issue is happening. It's still giving me the same error.

This is a simple one project solution that was working fine just last week. It appears to be an issue with VS trying to build the PDB file because I can delete them out of the Release and Debug folders without issue. When I try rebuilding them VS will start creating the file (about 1.4MB is size) but I still get the error.

+1  A: 

Is the program running/being debugged in another process? That's usually the first culprit.

casperOne
+1  A: 

Perhaps something else has the file open, like an editor or another copy of Visual Studio?

Try shutting down and restarting VS, or even rebooting your machine to see if that resolves the problem.

Tim Sullivan
A: 

The reason is almost certainly that another process is hanging onto a handle to that file which prevents it from being overwritten. VS is unfortunately often the culprit. If this is the case, restarting VS will fix the problem.

JaredPar
+1  A: 

In the worst case try to restart Visual Studio. Another good tool for you to try is Process Explorer from SysInternals that allows you to see who is keeping handle on your PDB file. This way you know exactly what to kill/restart to get access to the file.

David Pokluda
A: 

Visual Studio sometimes gets a bit "confused" about files being locked, especially if during a previous debugging run the application being debugged crashed unexpectedly, Visual Studio crashed unexpectedly, or even sometimes if you simply stop debugging.

Generally, the solution is to close and reopen Visual Studio.

Scott Dorman
+1  A: 

If you work on solution with more than one projects inside, there is possibility of wrong compile order.

Avram
+5  A: 

After banging my head on the wall for a while on this one and digging through source control to try to get back to a working copy, it turned out that the PDB file wasn't the issue at all. Someone had deleted a source file which was causing VS to choke when I tried to find that file to create the debug information.

So if anyone comes across this error and can't figure it out, make sure that you aren't missing a source file somewhere.

It would have been very helpful if VS would have told me that file is missing rather than just telling me it had an unspecified error creating the PDB file.

Thanks.

Ryan Smith
I came hear looking for a solution to the same problem. I had converted a "Web Site" to a "Web Project". This changes the "App_Code" folder to "Old_App_Code". Somehow, VS expected to find the files in both folders simultaneously. I didn't know MS was into quantum mechanics.I saw the missing files in "App_Code" with the yellow warning icon. When I deleted "App_Code" from the project, VS found my files in "Old_App_Code" and it worked just fine!
Rice Flour Cookies
thanks, finally able to resolve this. wasted too much time chasing ghosts!
TheZenker
A: 

Yes - definitely check for files that didn't get pulled down from VSS, if that's where you got your project from. Just look for the files with exclamation marks. Once all files in the project are where they should be locally, PDB gets generated w/o problems.