Esempio n. 1
0
        public override void Execute()
        {
            var assemblyName = Options["n"].Values[0];

            using (GacUtil gac = new GacUtil())
            {
                if (gac.UninstallAssembly(assemblyName))
                {
                    Console.WriteLine("Uninstalled '" + assemblyName + "' from the GAC.");
                }
            }
        }
Esempio n. 2
0
        public override bool Execute()
        {
            using (GacUtil gacutil = new GacUtil())
            {
                foreach (string assembly in gacutil.GetAllAssemblies())
                {
                    // Pull apart the name and the version.

                    int pos = assembly.IndexOf(',');
                    if (pos != -1)
                    {
                        string name = assembly.Substring(0, pos);
                        if (name.StartsWith(_assemblyPrefix, StringComparison.InvariantCultureIgnoreCase))
                        {
                            string rest = assembly.Substring(pos + 1);

                            if (rest.StartsWith(" Version="))
                            {
                                string version = rest.Substring(" Version=".Length);
                                if (version == _productVersion)
                                {
                                    gacutil.UninstallAssembly(assembly);
                                }
                            }
                        }
                        else if (Contains(_others, name))
                        {
                            // Ignore the version.

                            gacutil.UninstallAssembly(assembly);
                        }
                    }
                }
            }

            return(true);
        }