【发布时间】:2012-02-22 08:35:04
【问题描述】:
这是一个经典问题,有numerous 解决方案described。但是,它们似乎都不适合我。
我在 SharePoint 解决方案中使用 Report.NET 库。添加 Reports.dll 作为引用并编译会导致错误消息“程序集生成失败 - 引用的程序集 'Reports' 没有强名称。”但是,我的项目在项目属性中链接了一个 key.snk。因此,我尝试使用此密钥文件对 dll 进行反汇编、签名和重新组装,如其他地方所述:
C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MyProj
\dll>ildasm Reports.dll /out:Reports.il
C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MyProj
\dll>ilasm Reports.il /dll /resource=Reports.res /key=..\key.snk
<output removed for brevity>
Class 95
Class 96
Method Implementations (total): 1
Resolving local member refs: 0 -> 0 defs, 0 refs, 0 unresolved
Writing PE file
Signing file with strong name
Operation completed successfully
我最终得到了一个新的 Reports.dll,时间戳记到现在。但是,将其添加为对我的项目和构建的引用会给出与以前相同的错误消息。 “报告”引用的属性显示“强名称:假”。
不要因为有点麻烦而气馁,我尝试使用强命名实用程序重新签署程序集:
C:\Users\Administrator\Documents\Visual Studio 2010\Projects\MyProj
\dll>sn -R Reports.dll ..\key.snk
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly 'Reports.dll' successfully re-signed
可能值得注意的是,运行 SN 实用程序失败并显示错误消息“Reports.dll 不代表强命名程序集”,当在反汇编/签名/重新组装过程之前运行它。
但是,在反汇编/签名/重新组装之后运行它时,将其重新添加到 Visual Studio 时,我仍然会收到原始错误消息。
【问题讨论】:
标签: .net visual-studio-2010 sharepoint code-signing