Click on this icon to open the XML page.Tom Van Gaever - Blog
Search:   

Add DLL to GAC using C# 
Tuesday, January 19, 2010, 12:52 - .NET
Posted by Administrator
Reference the system.EnterpriseServicess assembly to your project.

using System.EnterpriseServices.Internal;

public void Update(DirectoryInfo folder_GAC)
{
  //check if folder containing new dll files exists
  if(folder_GAC.exists){
    //add each dll found in this folder to the Global Assembly Cache
    foreach (FileInfo dll in folder_GAC.GetFiles("*.dll")) 
    {
      //instantiate a new Publich object and install the dll
      Publish objpublish = new Publish();
      objpublish.GacInstall(dll.FullName);
    }    
  }
}


remove an assembly from the GAC can be done by using the GacRemove(string name) method.

more information:
http://msdn.microsoft.com/en-us/library ... blish.aspx

add comment ( 3 views )   |  permalink   |  related link   |   ( 3 / 596 )

<<First <Back | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | Next> Last>>