尝试合并 pdb 文件时出现 ILMerge 异常
我正在尝试将两个程序集合并为一个程序集,效果很好。然而,当我也尝试合并 *.pdb 文件时,出现错误:
对路径“F:\Fentec\Businessplan\trunk\Ausgabe\Debug\modules\Planrechnung\Planrechnung.pdb”的访问被拒绝。
如果我使用 /ndebug 选项来跳过合并 *.pdb 文件,它可以正常工作。但当然,调试时无法加载符号。起初,我认为在构建后事件中调用 ILMerge 时,Planrechung.pdb 正在使用并被锁定。我也尝试关闭VS2010并从命令行调用ILMerge,但结果仍然相同。我用 ProcessExplorer 检查过,文件上没有句柄。
这就是我调用 ILMerge 的方式:
E:\XP\Tools\ILMerge\ilmerge /targetplatform:v4,"D:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" /lib:"F:\Fentec\Businessplan\trunk\Ausgabe\Debug \bin" /out:Planrechnung.dll “F:\Fentec\Businessplan\trunk\Ausgabe\Debug\modules\Planrechnung\Planrechnung.dll” “F:\Fentec\Businessplan\trunk\Ausgabe\Debug\modules\Mandantenverwaltung\Mandantenverwaltung.dll”
我错过了什么吗?如果您需要任何其他信息,请询问。
您好,
斯卡利
I'm trying to merge two assemblies into a single assembly, which works quiet fine. Yet, when I try to merge the *.pdb files too, I get an error:
Access to the path "F:\Fentec\Businessplan\trunk\Ausgabe\Debug\modules\Planrechnung\Planrechnung.pdb" is denied.
If I use the /ndebug option in order to skip merging the *.pdb files, it works fine. But of course the symbols can't be loaded while debugging. At first I thought when calling ILMerge in the postbuild event, that Planrechung.pdb was in use and locked. I also tried closing VS2010 and call ILMerge from the command line, but the result remained the same. I checked with ProcessExplorer and there is no handle on the file.
This is how I call ILMerge:
E:\XP\Tools\ILMerge\ilmerge /targetplatform:v4,"D:\WINDOWS\Microsoft.NET\Framework\v4.0.30319" /lib:"F:\Fentec\Businessplan\trunk\Ausgabe\Debug\bin" /out:Planrechnung.dll "F:\Fentec\Businessplan\trunk\Ausgabe\Debug\modules\Planrechnung\Planrechnung.dll" "F:\Fentec\Businessplan\trunk\Ausgabe\Debug\modules\Mandantenverwaltung\Mandantenverwaltung.dll"
Have I missed something? If there are any additional infos you need, just ask.
Greetings,
Skalli
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经找到了问题的解决方案,但有点尴尬。
输出名称不得与合并的 pdb 文件之一同名。否则就会出现这个问题。当我更改程序集的名称时,效果很好。在此过程中覆盖程序集也没有问题,但无法覆盖现有的 pdb 文件。
我没想到这一点,也是偶然发现的。抱歉给您带来了麻烦
问候,
斯卡利
I've found the solution to the problem and it's a bit embarrassing.
The output name mustn't be the same name of one of the merged pdb files. Otherwise this problems occurs. When I changed the name of an assembly it worked great. It's also no problem to overwrite a assembly in the process, but you can't overwrite an existing pdb file.
I didn't expect this and stumbled across it by accident. Sorry for all the trouble
Greetings,
Skalli
在我看来,.pdb 文件已被锁定,可能是因为它正在调试器(例如 Visual Studio)中使用。
尝试关闭 Visual Studio 和您的应用程序(如果尚未关闭)。
如果这不起作用,请使用 Process Explorer 等工具来搜索打开该文件的进程。在流程资源管理器中,您可以使用“查找”->“查找”来执行此操作。查找句柄或 Dll...:
输入您要搜索的文件/pdb 的名称for ,它将列出打开该文件的所有进程 - 要么关闭各个句柄,要么终止/关闭这些应用程序,然后重试。
It sounds to me like the .pdb file is locked, probably because it is in use in a debugger (such as Visual Studio).
Try closing both Visual Studio and your application (if you already haven't).
If that doesn't work then use a tool like Process Explorer to search for processes that have that file open. In process explorer you can do this using the Find -> Find Handle or Dll...:
Enter the name of the file / pdb you are searching for and it will list all processes that have that file open - either close the individual handles or kill / close those applications and try again.