Cannot install assembly to cache?
Asked Answered
G

3

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?

Gilberto answered 25/8, 2014 at 19:49 Comment(3)
Did you do the strong name signing on your assembly?Hallock
Please explain in detail the steps you did in both visual studio and in the console to install the program in to the GAC.Hallock
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.Gilberto
A
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.

Anther answered 25/8, 2014 at 19:53 Comment(4)
I signed the Assembly in Visual Studio but that doesn't seem to work.Gilberto
I advise you to check if dll was signed correctly. You can follow first approach from this article: blog.codingoutloud.com/2010/03/13/… Please, tell the results.Anther
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?Gilberto
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.Anther
K
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.

Kleper answered 3/3, 2019 at 22:21 Comment(0)
L
-1

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

Luxe answered 1/11, 2016 at 17:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.