8

I tried to install an assembly in GAC using new System.EnterpriseServices.Internal.Publish().GACInstall("Foo.dll"); But I could not find that installed in c:\windows\assembly\gac_msil folder. I did not receive the securityexception as well. Can anyone help me

1 Answer 1

11

First of all, make sure it's signed. I assume it is since you didn't get any exceptions. Also, if it's a .net 4.0 assembly, it will be GACed at a new location @ %windir%\Microsoft.NET\assembly\

More on this here: .NET 4.0 has a new GAC, why?

UPDATE: Signing Assembly

Right click on the Assembly project and go to "Properties". On the "Project Properties" screen select "Signing" tab. Check "Sign the assembly" and in the "Choose strong name key file" select "new". That will open up a dialog where you have to specify the key name. I usually use solution name as my key name. You can also password protect the key (your preference). Once you're done, hit "OK" on the dialog and build your project. Now try to GAC it again.

Quick suggestion: If you have multiple assemblies in the project you'd like to GAC, you could share the same key file instead of generating a new one for each. I usually drop my key file in the same location where my Solution file sits and share it across projects in the solution.

1
  • Thanks for the piece of info. I have .net3.5 and also checked in windows Explorer(C:\windows\assemby) ,where I could not find it. But I am unaware about signing. can you let me know how to sign a managed DLL Apr 2, 2011 at 3:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.