May 24, 2015 asvignesh 1Comment

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”);

Software developer experience in building storage management and Data protection software for the Private and public cloud.

Disclaimer :

This is a personal weblog. The opinions expressed here represent my own and not those of my employer. my thoughts and opinions change from time to time… This weblog is intended to provide a semi-permanent point in time snapshot and manifestation of the various memes running around my brain, and as such any thoughts and opinions expressed within out-of-date posts may not the same, nor even similar, to those I may hold today.

One thought on “Register dll in GAC without using gacutil

Leave a Reply

Your email address will not be published. Required fields are marked *

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