我们在调试GAC中部署的程序时候,很可能碰到下面的报告:
---------------------------
Microsoft Visual Studio
---------------------------
The following module was built either with optimizations enabled or without debug information:
C:/Windows/assembly/GAC_MSIL/优快云.Community.TopicListDataCenter.EnterpriseComponents/2.5.1.23407__cdde601ea7585548/aaa.dll
To debug this module, change its project build configuration to Debug mode. To suppress this message, disable the 'Warn if no user code on launch' debugger option.
---------------------------
确定
---------------------------
这是因为VS开发工具在C:/Windows/assembly/GAC_MSIL/优快云.Community.TopicListDataCenter.EnterpriseComponents/目录下没有找到aaa.pdb调试符号文件。当然这个目录是GAC的目录,不可能有的。
如何解决,最笨的方法是吧 PDB 文件 Copy 到那个目录去。
我这里要说的解决方法当然不是这样的了。而是如下:
在Visual Studio 的调试属性中去掉 Enable Just My Code(Managed only)
这时候我们再去调试就不会出现上述提示文本了。也不会找不到 PDB文件了。一切都OK了。
我们在Modules窗口也可以看到成功加载了正确位置的pdb文件。
参考资料:
You Don't Need to Copy PDB Files to Debug in the GAC!
http://www.elumenotion.com/Blog/Lists/Posts/Post.aspx?ID=23