Partager via


Installing dll into GAC with PowerShell

You may install a dll into the GAC (global assembly cache) by doing the following:

 [Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null 
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish
$publish.GacInstall(<<FullFilePathToTheDll>>)
 

This has to do very little with native PowerShell but rather with instantiating and using .NET libraries from PowerShell

Comments

  • Anonymous
    October 25, 2015
    i did this [Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null [System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish $publish.GacInstall(<<1.dll>>) $publish.GacInstall(<<2.dll>>) $publish.GacInstall(<<3.dll>>) iisreset now my first dll cannot be found in the GAC...