Created
July 25, 2012 07:24
-
-
Save zmilojko/3174904 to your computer and use it in GitHub Desktop.
Source of the ZGacInst - my little utility that will add assemblies to and remove them from GAC. Replaces GacUtil, which MS for some reason keeps weirdly licensed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GacUtil my own way. | |
// Since GacUtil is not distributed with .NET framework (after 1.1.), should yo uwant to install your assemblies to GAC, | |
// you are likely to need this code. | |
using System; | |
// Add reference: System.EnterpriseServices | |
namespace ZGacInst | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
if (args.Length != 2 || (args[0].ToLower() != "-i" && args[0].ToLower() != "-u")) | |
{ | |
Console.WriteLine("Error. Usage: \"ZGacInst -i <path>\" or \"ZGacInst -u <path>\"."); | |
} | |
if (args[0].ToLower() == "-i") | |
{ | |
new System.EnterpriseServices.Internal.Publish().GacInstall(args[1]); | |
} | |
else if (args[0].ToLower() == "-u") | |
{ | |
new System.EnterpriseServices.Internal.Publish().GacRemove(args[1]); | |
} | |
else | |
{ | |
Console.WriteLine("Error. Usage: \"ZGacInst -i <path>\" or \"ZGacInst -u <path>\"."); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment