Unable to create PDB file

爱⌒轻易说出口 提交于 2019-11-29 02:06:52

问题


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:


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.




回答2:


Here is a MUCH better way to fix this issue.

Basically close your solution and re-open it without compiling. Check the Error List and it will show you which files are missing.




回答3:


This worked for me where the other answer's here failed:

Unable to write to output file [FileName] .pdb: Unspecified error Visual Studio




回答4:


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.




回答5:


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.




回答6:


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




回答7:


Check for missing files which will be shown in visual studio with exclamatory icon and those files may not exist in project source folder. if you don't want those files delete them in visual studio else add those files in source folder. clean or refresh..




回答8:


I was receiving the same error and it ended up being a web reference that needed to be updated. After updating all the web references the issue persisted. Finally I added the same web reference as the same url and name and the add web reference told me that there was a reference by the same name and provided an option to update it with the latest information. This finally worked and the project is running again.




回答9:


I wanted to add on top of the typical Turn it off and on again with the reason why that's helpful.

Visual studio can get wrapped around the axle when building a project so that it can't figure out why it's missing a particular dependency, it just knows that it can't build the project.

Here's an undescriptive error message after a failed rebuild:

The solution is to:

  1. Close Visual Studio
  2. Open Visual Studio
  3. Do Not Compile - Look at the error list for a new descriptive error:

A lot of the existing instructions are missing the third step, so I thought this might be helpful.




回答10:


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.




回答11:


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.




回答12:


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.




回答13:


I was getting same error. Turned out that the 'Service Reference' folder was out of date. I deleted and added service reference again and it started working.




回答14:


This same error happened to me but it had a different cause. Someone had deleted a file for a project but didn't update the project file; therefore the project was looking for the file. The file had a yellow caution icon displaying over it. When I excluded the file from the project the issue was fixed.




回答15:


I'm on VS2005 and encountered this error when I opened a web project as a "Solution"--opened the .sln file--and hit build/rebuild. Once I closed the Solution and re-opened it as a "Project"--opened the .vbproj file--I got the specific missing source code errors when I compiled/recompiled. I made sure all the files were present and voila, it completed the build successfully!



来源:https://stackoverflow.com/questions/627523/unable-to-create-pdb-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!