1

How can I perform the operations done by gacutil, like installing assemblies or listing the contents of the GAC, programatically in C#? Or to put it another way, is gacutil layered on top of a public API that I can access from C#?

I'm currently running under .Net Framework 4.0 and using Visual Studio 2010, but I'll be upgrading to VS 2012 and .Net 4.5 in the near future. I don't like using command-line programs when I have a GUI alternative because I'm a fumble-fingered typist so I thought I'd write my own GUI-based utility for some things that gacutil does. I know there are some on the web but they're old or only spottily-maintained so I'd rather write my own.

user316117
  • 7,971
  • 20
  • 83
  • 158

1 Answers1

4

You can easily add dll to GAC using Publish class. Add reference to System.EnterpriseServices

System.EnterpriseServices.Internal.Publish publish = new System.EnterpriseServices.Internal.Publish();
publish.GacInstall("dll path");

enumerating assemblies in GAC

Community
  • 1
  • 1
Kurubaran
  • 8,696
  • 5
  • 43
  • 65