0
votes

In my solution, there have one C# class library project(A project). I would like to add the strongly named assembly in that project. But (A project) has include another DLL (B.dll).

I generate the "a.snk" using VS2012 x86 Native Tools Command Prompt. Like this

sn.exe -k C:\A.snk

And I add the following code in "AssemblyInfo.cs" of (A project). Then build the project.

[assembly: ComVisible(true)]

[assembly: AssemblyDelaySign(false)]

[assembly: AssemblyKeyFile("C:\A.snk")]

After build (A project), it has a error "Assembly generation failed -- Referenced assembly 'B' does not have a strong name". But (B.DLL) is created by third party.

How to fix it? Many Thanks.

2

2 Answers

0
votes

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' ?

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

0
votes

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.

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.