Wednesday, June 20, 2012

Install or UnInstall Assembly dll into GAC using PowerShell

Introduction:
In this article we will discuss how to install and uninstall an assembly dll into GAC using PowerShell commands. Also you can check my last article on Some SharePoint 2010 PowerShell commands.

Description:
Suppose you have a dll and you want to put  it inside the GAC (C:\Windows\assembly), then you have to do this using commands. Because direct copy paste is not allowed there. So the better approach is to use Gacutil tool. To put a dll into GAC, the dll should be strongly named.
Here we will see how we can use Gacutil through PowerShell.

First Open PowerShell in Administrative mode. For this go to Start then SharePoint 2010 Management Shell then Run as Administrator.

Then type Set-Alias in the PowerShell command window.

It will then ask you Name and Value.

For Name put: Gacutil
And for Value Put: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\gacutil.exe

Command to Install:
Gacutil /i C:\MySampleDll.dll

Command to UnInstall:
Gacutil /u MySampleDll.dll

Here MySampleDll is the name name of custom dll I want to put in GAC.

Check out the figure for more reference.

No comments:

Post a Comment