Wednesday, December 18, 2013

Install to global assembly cache without gacutil

In Windows Server 2012 you can't install a DLL to the GAC by drag/drop, but you can do it using GACUTIL.exe.
GacUtil.exe is not present on the server by default.
You can do it using the following script instead of Gacutil.exe
Run your powershell and use command like sample below:
.\Add-AssemblyToGlobalAssemblyCache.ps1 FullPath\itegration.dll
This will applied in legacy windows versions

In Windows 2012 you can use the following PowerShell to install dll to GAC

Set-location "c:\temp"
[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:\temp\MyDLL.dll")
iisreset

 In Windows 2012 you can use the following PowerShell to remove dll from GAC:

Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\temp\MyDLL.dll")
iisreset

1 comment:

Anonymous said...

C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools