Register dll in GAC without using gacutil

Usually we register the dll to the Global Assembly Cache a.k.a GAC using the Visual Studio developer console Gacutil or earlier to Windows server 2012 you can simply drag and drop to the Windows Assembly folder

With the Windows server 2012 drag and drop the file to the assembly folder will no longer work

In this scenario developer can use Powershell

To add DLL to the Global Assembly Cache

Run the powershell

PS C:\Users\Vignesh> [System.Reflection.Assembly]::Load(“System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”)

GAC    Version        Location
—    ——-        ——–
True   v4.0.30319     C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50…

PS C:\Users\Vignesh> $publish = New-Object System.EnterpriseServices.Internal.Publish
PS C:\Users\Vignesh> $publish.GacInstall(“C:\Users\Vignesh\bin\asvignesh.dll”);

To remove DLL from the Global Assembly Cache (Unregister)

Run the powershell

PS C:\Users\Vignesh> [System.Reflection.Assembly]::Load(“System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”)

GAC    Version        Location
—    ——-        ——–
True   v4.0.30319     C:\Windows\Microsoft.Net\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50…

PS C:\Users\Vignesh> $publish = New-Object System.EnterpriseServices.Internal.Publish
PS C:\Users\Vignesh> $publish.GacRemove(“C:\Users\Vignesh\bin\asvignesh.dll”);

One comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from

Subscribe now to keep reading and get access to the full archive.

Continue reading