Unable to create PDB file

Viewed 28600

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.

16 Answers

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.

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.

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.

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

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.

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.

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.

I had this problem in a VS2010 solution and I tried all of the accepted answers above but still couldn't figure out why the compiler can't find the (Test.vb) file. As some of the answers has already mentioned, .pdb file is not the actual error.

The error is the one appears in the error list after re-opening the solution without building it, which is, Unable to open module 'C:\Test\Test.vb'. However, re-opening the solution did not work for me. The error was suggesting that 'Test.vb' is missing even though 'Test.Vb' file EXISTS in my local copy. So why it can't find it?

The solution I found for this, is:

  1. Close the solution, close VS2010 and re-open the solution in VS2015. VS2013 might also work but I have not tried it.
  2. I built the solution in VS2015 which of course failed but the error this time (particularly in Output window, where it shows the build lines, including the errors occurred during the compile) was showing the full PATH of the 'Test.vb' file that the compiler was trying to locate. The path was 'C:\Test\..\..\Test.vb' suggesting that, in building 'Test.vbproj' project, the compiler started its build in 'C\Test' folder and then appended the location of the .vb file, defined in the .sln file which is '..\..\Test.vb' to read 'Test.vb' file and build the project. Only it couldn't navigate to 'C:\Test\..\..\Test.vb' folder, where 'Test.vb' is.

By correcting the location of 'Test.vb' in .sln file, it built fine.

Related