简体   繁体   English

程序集生成失败-引用的程序集“ XXXX”没有强名称

[英]Assembly generation failed — Referenced assembly 'XXXX' does not have a strong name

In my solution, there have one C# class library project(A project). 在我的解决方案中,有一个C#类库项目(一个项目)。 I would like to add the strongly named assembly in that project. 我想在该项目中添加强命名程序集。 But (A project) has include another DLL (B.dll). 但是(一个项目)已经包含另一个DLL(B.dll)。

I generate the "a.snk" using VS2012 x86 Native Tools Command Prompt. 我使用VS2012 x86本机工具命令提示符生成“ a.snk”。 Like this 像这样

sn.exe -k C:\\A.snk sn.exe -k C:\\ A.snk

And I add the following code in "AssemblyInfo.cs" of (A project). 然后在(一个项目)的“ AssemblyInfo.cs”中添加以下代码。 Then build the project. 然后构建项目。

[assembly: ComVisible(true)] [汇编:ComVisible(true)]

[assembly: AssemblyDelaySign(false)] [assembly:AssemblyDelaySign(false)]

[assembly: AssemblyKeyFile("C:\\A.snk")] [程序集:AssemblyKeyFile(“ C:\\ A.snk”)]

After build (A project), it has a error "Assembly generation failed -- Referenced assembly 'B' does not have a strong name". 生成(A项目)后,它出现错误“程序集生成失败-引用的程序集'B'没有强名称”。 But (B.DLL) is created by third party. 但是(B.DLL)是由第三方创建的。

How to fix it? 如何解决? Many Thanks. 非常感谢。

You have a problem. 你有个问题。 Your only option is to ask the third party to provide a strong name otherwise you won't be able to do it for your application. 您唯一的选择是要求第三方提供一个强名,否则您将无法为您的应用程序使用它。 The point of these strong names is to create some kind of accountability are you going to be accountable for your app if the third party dll is failing or doing things that are not 'normal' ? 这些强名称的目的是要建立某种责任制,如果第三方dll出现故障或执行不正常的操作,您是否要为您的应用程序负责?

This question has been asked before I found something on msdn : https://social.msdn.microsoft.com/Forums/vstudio/en-US/35930958-9775-4e56-bd38-0362d124ffc4/assign-strong-name-to-third-part-dll 在我在msdn上找到东西之前,已经问过这个问题: https : //social.msdn.microsoft.com/Forums/vstudio/en-US/35930958-9775-4e56-bd38-0362d124ffc4/assign-strong-name-to-第三方DLL

You don't have to create a strong name for your assembly (A project) just because it references an assembly with a strong name. 您不必为程序集(项目)创建一个强名称,仅因为它引用了一个具有强名称的程序集。 Simply don't do that and you will be able to compile your assembly without problems. 只需不这样做,您就可以毫无问题地编译程序集。 In fact, all the BCL assemblies have strong names and could otherwise not be referenced. 实际上,所有BCL程序集都有强名称,否则将无法引用。

But as Philip Stuyck is telling in the answer above, if you need to create a strong name, you will have to ask your third-party vendor for a signed version of B.DLL. 但是正如Philip Stuyck在上面的答案中告诉的那样,如果您需要创建一个强名称,则必须向第三方供应商索要B.DLL的签名版本。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 程序集生成失败-引用的程序集“ Interop.Office”没有强名称 - Assembly generation failed — Referenced assembly 'Interop.Office' does not have a strong name 程序集生成失败-引用的程序集“ Google.Apis”没有强名称 - Assembly generation failed — Referenced assembly 'Google.Apis' does not have a strong name 错误8程序集生成失败-引用的程序集'LibUsbDotNet'没有强名称 - Error 8 Assembly generation failed — Referenced assembly 'LibUsbDotNet' does not have a strong name 如何修复“引用的程序集没有强名称”错误 - How to fix "Referenced assembly does not have a strong name" error 引用程序集“ CitiReusableCode”没有强名称的意思是什么,以及如何解决它? - What does Referenced assembly 'CitiReusableCode' does not have a strong name mean and how to solve it? 引用的程序集 'Twilio,Version=5.68.0.0,Culture=neutral,PublicKeyToken=null' 没有强名称。 特维利奥 - Referenced assembly 'Twilio, Version=5.68.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. Twilio 强名验证不会因修改的程序集而失败 - Strong name verification does not fail for modified assembly 检查程序集是否有强名称 - Checking an assembly for a strong name 参考没有强名称的汇编 - Reference to assembly without strong name 强名称签名验证程序集的哪些部分 - What parts of an assembly does the strong name signing verify
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM