强命名三个相互引用的程序集
这可能真的很简单,但我很困惑(而且我是 c# 菜鸟)。我有 3 个相互引用的程序集(例如,注册委托方法的通知,或调用公共方法),所有这些程序集都可以正常编译,直到我尝试使用强名称对它们进行签名。然后我无法编译它们中的任何一个,因为另外两个没有强名称。我缺少什么?我已经为这三个文件创建了一个强名称文件,但无法包含 snk 并编译它们。
This is probably really easy, but I'm stumped (and I'm a noob with c#). I have 3 assemblies that reference each other (for example, registering for notification of a delegate method, or calling a public method), all of which compile fine until I try to sign them with a strong name. Then I can't compile any of them, since the other two don't have a strong name. What am I missing? I've created a strong name file for all three, but can't include the snk and compile them.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您已创建一个 snk 文件并希望在所有三个文件上使用,请选择:
从项目的上下文菜单中添加现有项目。
浏览到 snk 文件,然后通过单击“添加”按钮旁边的箭头选择“添加为链接”。
然后在项目属性中,确保在“签名”选项卡中选中“对程序集进行签名”复选框,然后选择刚刚添加到项目中的密钥文件。
那应该可以解决问题。
If you have created one snk file that you want to use on all three of them choose:
Add Existing Item from the context menu on the projects.
Browse to the snk file and then choose "Add as link" by clicking on the arrow next to the Add button.
Then in your project properties make sure in the tab Signing check the "Sign the assembly" checkbox and then select the keyfile you just added to your project.
That should do the trick.
强命名程序集只能引用其他强命名程序集。
引自 MSDN。
A strongly named assembly can only reference other strongly named assemblies.
Quoted from MSDN.