Skip to content

Instantly share code, notes, and snippets.

@zmilojko
Created July 25, 2012 07:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zmilojko/3174904 to your computer and use it in GitHub Desktop.
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.
// 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