The new way for Installing on the GAC

7. January 2009 11:36 by Mrojas in General  //  Tags:   //   Comments (0)

A long long time ago, I faced the problem of installing an assembly on the GAC from code. And I even posted the code in my blog

 http://blogs.artinsoft.net/mrojas/archive/2008/04/09/install-assembly-gac-with-c.aspx

 

Recently Jose Cornejo wrote me on my blog because the code was not working, and he finally showed me the right way to do it. It was sooo easy.

His solution was:

1. Add a reference to System.EnterpriseServices.dll to your project

2. Write code like the following:

            System.EnterpriseServices.Internal.Publish p = new Publish();
            p.GacInstall(@"C:\ClassLibrary1.dll");
            p.GacRemove(@"C:\ClassLibrary1.dll");

 

Thanks a lot Jose for your help.