Using PowerShell to Install a DLL into the GAC

If you want to install a DLL into the Global Assembly Cache (GAC) you have several ways to do it. One of them is using gacutil.exe. But gacutil.exe comes with Visual Studio installation and if you are working on a server environment it is difficult to install a development tool.

An alternative is to use PowerShell to install the DLL into the GAC. You can use the code below for this.

[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")            
$publish = New-Object System.EnterpriseServices.Internal.Publish            

If your web application running on IIS (Internet Information Services) you need to reset IIS with below command.


Add a Comment

Your email address will not be published.