1

I am trying to add new DLLs to the GAC (Global Assembly Cache) from C# code. Is this even possible? what is the best way to do it?

We are using a clickonce installer to update an application. I want to be able to GAC from the code any new DLLs that are new in the solution.

These files need to be in the GAC, as a requirement.

hunch_hunch
  • 2,283
  • 1
  • 21
  • 26

1 Answers1

1

You can do it from C# using the GAC/Fusion API documented here and here. An example in C# can be found here (thanks to Hans Passant), here or here. A simpler alternative are the GacInstall and GacRemove methods of the System.EnterpriseServices.Internal.Publish class, but they lack features and proper error reporting.

Community
  • 1
  • 1
Lars Truijens
  • 42,837
  • 6
  • 126
  • 143