Sometime scenarios occur when the target machine does not have GacUtil.exe. GacUtil is included with Visual Studio (as part of the Microsoft SDK).
In such scenario you can register Assembly in GAC programmatically using Publish.GacInstall method. First you should sign your Assembly with a Strong Name.
Now follow the below steps-
- Create a Console Application.
- Add a new reference to the Project – System.EnterpriseServices
- Add ‘using System.EnterpriseServices.Internal‘ to your .cs file.
- Add the following code to main method-
5. Build the code.
6. Copy the .exe to the target machine and run it.
7. Verify that the Assembly is registered in GAC. GAC path- C:WINDOWSassembly
For more details on this method, refer the MSDN link.
Please leave your comments and feedback.
Thanks for checking out !
Latest posts by Abhimanyu (see all)
- Switch between multiple proxies in Chrome browser [ProxySwitchy Guide] - February 12, 2016
- CISCO VPN CLIENT -REASON 442: FAILED TO ENABLE VIRTUAL ADAPTER [Fix] - January 31, 2016
- CynogenMod 13 (Android Marshmallow [6.0]) on Samsung Galaxy S3 GT-I9300. [21-12-2015] - December 21, 2015