无法创建PDB文件
由于某种原因,今天我的一个项目中开始出现此错误。
错误 1 无法写入输出文件 'C:\MyProject\Release\MyProject.pdb': 未指定的错误
如果我进入高级编译选项并将其更改为不生成和调试信息,我的项目可以正常编译。
我尝试将 Release 文件夹的权限设置为对每个人来说都是完全的,所以我认为这不是权限问题。 另外,我在日志文件中没有看到任何可以为我提供有关该问题的更多信息的内容。
有谁知道为什么这个错误会开始出现或修复它的方法?
谢谢。
更新:我已经重新启动了我的机器,重新启动了 VS 几次,甚至完全删除了发生问题的现有 OBJ 文件。 它仍然给我同样的错误。
这是一个简单的单项目解决方案,上周运行良好。 这似乎是 VS 尝试构建 PDB 文件的问题,因为我可以毫无问题地将它们从 Release 和 Debug 文件夹中删除。 当我尝试重建它们时,VS 将开始创建文件(大小约为 1.4MB),但我仍然收到错误。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(16)
在我为此一头撞墙并深入研究源代码管理以尝试返回工作副本之后,结果证明 PDB 文件根本不是问题所在。 有人删除了一个源文件,当我试图找到该文件来创建调试信息时,导致 VS 阻塞。
因此,如果有人遇到此错误并且无法解决,请确保您没有在某处丢失源文件。
如果 VS 告诉我文件丢失而不是仅仅告诉我创建 PDB 文件时出现未指定的错误,那将会非常有帮助。
谢谢。
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.
这是一个更好的方法 修复此问题。
基本上关闭您的解决方案并重新打开它而不进行编译。 检查错误列表,它会显示哪些文件丢失。
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.
这对我有用,而其他答案在这里失败了:
无法写入输出文件 [FileName] .pdb:未指定错误 Visual Studio
This worked for me where the other answer's here failed:
Unable to write to output file [FileName] .pdb: Unspecified error Visual Studio
也许有其他东西打开了该文件,例如编辑器或 Visual Studio 的另一个副本?
尝试关闭并重新启动 VS,甚至重新启动计算机以查看是否可以解决问题。
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.
在最坏的情况下,请尝试重新启动 Visual Studio。 您可以尝试的另一个好工具是 SysInternals 的 Process Explorer,它允许您可以查看谁在处理您的 PDB 文件。 这样您就可以确切地知道要终止/重新启动什么才能访问该文件。
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.
检查丢失的文件,这些文件将在 Visual Studio 中显示并带有感叹号图标
并且这些文件可能不存在于项目源文件夹中。 如果您不希望这些文件在 Visual Studio 中删除它们,则将这些文件添加到源文件夹中。 清洁或刷新..
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..
我收到了同样的错误,它最终成为需要更新的网络参考。 更新所有网络参考后,问题仍然存在。 最后,我添加了相同的 Web 引用作为相同的 url 和名称,并且添加 Web 引用告诉我有一个同名的引用,并提供了一个选项来使用最新信息更新它。 这终于奏效了,项目再次运行。
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.
我想在典型的
关闭并再次打开
之上添加其有用的原因。Visual Studio 在构建项目时可能会陷入困境,因此它无法弄清楚为什么缺少特定依赖项,它只知道它无法构建项目。
以下是重建失败后出现的不具描述性的错误消息:
解决方案是:
很多现有说明都缺少第三步,所以我认为这可能会有所帮助。
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:
A lot of the existing instructions are missing the third step, so I thought this might be helpful.
几乎可以肯定,原因是另一个进程挂在该文件的句柄上,从而防止该文件被覆盖。 不幸的是,VS 常常是罪魁祸首。 如果是这种情况,重新启动 VS 即可解决问题。
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 有时会对文件被锁定感到有点“困惑”,特别是在之前的调试运行期间,正在调试的应用程序意外崩溃,Visual Studio 意外崩溃,甚至有时只是停止调试。
一般来说,解决方案是关闭并重新打开 Visual Studio。
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.
是的 - 如果您的项目是从 VSS 中获取的,请务必检查是否有未从 VSS 中提取的文件。 只需查找带有感叹号的文件即可。 一旦项目中的所有文件都位于本地应有的位置,PDB 就会生成,不会出现任何问题。
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 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.
同样的错误也发生在我身上,但原因不同。 有人删除了项目的文件,但没有更新项目文件; 因此该项目正在寻找该文件。 该文件上方显示一个黄色警告图标。 当我从项目中排除该文件时,问题得到解决。
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.
我在 VS2005 上,当我打开一个 Web 项目作为“解决方案”(打开 .sln 文件)并点击构建/重建时,遇到了此错误。 当我关闭解决方案并将其作为“项目”重新打开(打开 .vbproj 文件)时,我在编译/重新编译时遇到了特定的丢失源代码错误。 我确保所有文件都存在,瞧,它成功完成了构建!
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!
我在 VS2010 解决方案中遇到了这个问题,我尝试了上面所有接受的答案,但仍然无法弄清楚为什么编译器找不到 (Test.vb ) 文件。 正如一些答案已经提到的,.pdb 文件不是实际的错误。
该错误是在未构建解决方案的情况下重新打开解决方案后出现在错误列表中的错误,即“Unable to open module 'C:\Test\Test.vb'”。 但是,重新打开解决方案对我来说不起作用。 该错误表明即使我的本地副本中存在'Test.vb' 文件,'Test.vb' 仍丢失。 那为什么找不到呢?
我为此找到的解决方案是:
通过更正 .sln 文件中 'Test.vb' 的位置,它构建得很好。
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:
By correcting the location of 'Test.vb' in .sln file, it built fine.