7

I am trying to add an assembly to the cache on Visual Studio 2010 Command Prompt. I get this error "Failure adding assembly to the cache: Attempt to install an assembly without a strong name". I am adding a ListTasks2.dll assembly from a WCF Service App called ListTasks2. I never had this issue with a similarly-named project, so why is it raising an issue now?

NOTE: I tried signing it in Visual Studio and it still doesn't work. I wonder if it might be a permission issue. I used different user credentials and was able to add an assembly. The catch is that I loaded a VS Solution, and that project signed the assembly. Should I just create a key pair?

Chris
  • 89
  • 1
  • 2
  • 10
  • Did you do the strong name signing on your assembly? – Scott Chamberlain Aug 25 '14 at 19:53
  • Please explain in detail the steps you did in both visual studio and in the console to install the program in to the GAC. – Scott Chamberlain Aug 25 '14 at 21:13
  • First, in Visual Studio I right-clicked the project ListTasks2, navigated to the Signing tab, and signed the Assembly with a key file. Net, I opened VS Command Prompt as admin and navigated to the folder where ListTasks2.dll was and typed "gacutil.exe -i ListTasks2.dll" I received the error message. – Chris Aug 25 '14 at 21:54

3 Answers3

8

Only strong-named assemblies can be installed into the GAC. For information about how to create a strong-named assembly, see How to: Sign an Assembly with a Strong Name.

ntl
  • 1,289
  • 1
  • 10
  • 16
  • I signed the Assembly in Visual Studio but that doesn't seem to work. – Chris Aug 25 '14 at 20:57
  • I advise you to check if dll was signed correctly. You can follow first approach from this article: http://blog.codingoutloud.com/2010/03/13/three-ways-to-tell-whether-an-assembly-dl-is-strong-named/ Please, tell the results. – ntl Aug 25 '14 at 21:16
  • I used IL Disassembler, and I could not find a public key. So it is not strongly named. I already signed the assembly in Visual Studio, so I am wondering what the issue is? – Chris Aug 25 '14 at 21:51
  • I am not sure what is the problem, do you have *.pfx (key file) in your solution? Please check properties of your project (signing tab), you should see 'Sign the assembly' selected and (important) selected strong name key file, is it correct? If no, try to sign your assembly again. Maybe key file was deleted, and therefore there is no public key in dll's manifest. – ntl Aug 26 '14 at 04:49
1

This issue seems to be thought a lot harder and more roundabout than what it needs to be.

I found a really achieveable solution here:

http://codeingaddiction.blogspot.com/2011/06/how-to-add-strong-name-to-existing-dll_16.html

For me to get this to work easily I changed directory to C:\temp - this worked a lot better to me than running directly in the folder mentioned, probably because of file permissions being more accessible in somewhere like that.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Jack
  • 472
  • 6
  • 13
-1

u can create the SNK or PFX to the class libaray and then add to gacutil through VS command Prompt

Prem S
  • 11
  • 3