How to deploy DLLs to the GAC

If you need to deploy DLL files to the GAC of a server, you can do it by executing the following PS code:

[System.Reflection.Assembly]::Load(System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall(C:TestTest.dll)
iisreset

In case you need to remove the dll from the GAC, you can do it by executing the following:

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

Hopet it helps!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s