Question:-
How to install a DLL to the GAC on Windows Server 2012 using only PowerShell (without having to install SDK or Visual Studio)
Answer:-
A DLL file is a module containing certain functions that can be used by multiple programs as long as it is registered. Please follow the steps below to manually register a DLL file.
To add a DLL to the GAC
1. Login into your Windows server 2012.
2. Search for PowerShell console and run as Administrator.
3. Enter the following code to console.
1
2
3
4
5
| 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\yourdllname.dll" ) iisreset |
To remove a DLL from the GAC
1. Login into your Windows server 2012.
2. Search for PowerShell console and run as Administrator.
3. Enter the following code to console.
1
2
3
4
5
| 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\yourdllname.dll" ) iisreset |
No comments:
Post a Comment