Exemple #1
0
        private static void Remove()
        {
            try
            {
                System.EnterpriseServices.Internal.Publish pub = new System.EnterpriseServices.Internal.Publish();
                pub.GacRemove(thispath + @"\QueryAnalyzer_DataProvider.dll");
                Console.WriteLine("QueryAnalyzer_DataProvider.dll is removed from gac.");

                {
                    Configuration c     = ConfigurationManager.OpenMachineConfiguration();
                    string        cpath = c.FilePath;
                    RemoveNode(cpath);

                    string cpath32 = GetConfigPath32(cpath);
                    if (cpath32 != null)
                    {
                        RemoveNode(cpath32);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error occurred while uninstalling QueryAnalyzer_DataProvider.dll: {0}", e.ToString());
            }
        }
Exemple #2
0
        public static void RemoveAssembliesFromGac(string searchPattern)
        {
            var assemblyPaths = GetGacAssemblyPaths(searchPattern);
            var backupPath = Path.Combine(Environment.CurrentDirectory, @"GAC_Backup");

            foreach (var assemblyPath in assemblyPaths)
            {
                // For safety, only allow files with a "MEDSEEK" or "Agatha" prefix to be removed from GAC
                var fileName = new FileInfo(assemblyPath).Name;

                if (fileName.StartsWith("MEDSEEK", StringComparison.OrdinalIgnoreCase) || fileName.StartsWith("Agatha", StringComparison.OrdinalIgnoreCase))
                {
                    LoggingUtils.WriteInfo(string.Format(CultureInfo.InvariantCulture, "Removing assembly ({0}) from GAC", fileName));

                    // Backup assembly
                    BackupAssembly(assemblyPath, backupPath);

                    // Remove assembly from GAC
                    var publisher = new System.EnterpriseServices.Internal.Publish();
                    publisher.GacRemove(assemblyPath);
                }
                else
                    LoggingUtils.WriteWarn(string.Format(CultureInfo.InvariantCulture, "Skipping removal of non-MEDSEEK assembly ({0}) from GAC", fileName));
            }

            LoggingUtils.WriteInfo(string.Format(CultureInfo.InvariantCulture, "GAC assemblies backed up to: ({0})", backupPath), ConsoleColor.Green);
        }
 protected override void ExecutePublish(System.EnterpriseServices.Internal.Publish publish, string path)
 {
     if (File.Exists(path))
     {
         Log.LogMessage(MessageImportance.Normal, "GacRemove: {0}", path);
         publish.GacRemove(path);
     }
 }
Exemple #4
0
        public override void Uninstall(System.Collections.IDictionary savedState)
        {
            //#if DEBUG
            //            MessageBox.Show("Uninstalling");
            //#endif
            RegistryKey rk = Registry.CurrentUser.OpenSubKey(InstallerSupport.GetProperty("RegKey"), true);

            AssemblyName = Context.Parameters["AssemblyName"];
            string InstallPath = rk.GetValue(InstallerSupport.GetProperty("InstallPathKey")).ToString();

            string strAssemblyFiles = base.Context.Parameters["gacname"].ToString();

            try
            {
                base.Uninstall(savedState);
                // remove from GAC

                if (strAssemblyFiles.Length > 0)
                {
                    System.EnterpriseServices.Internal.Publish publish = new System.EnterpriseServices.Internal.Publish();
                    foreach (string strAssemblyFile in strAssemblyFiles.Split('|'))
                    {
                        try
                        {
                            string[] strAssembly = strAssemblyFile.Split('*');
                            // if (!strAssembly[0].EndsWith(".Core.dll"))
                            //{

                            publish.GacRemove(Path.Combine(Path.Combine(InstallPath, "Control"), strAssembly[0]));
                            //}
                        }
                        catch { }
                    }
                }
            }
            catch { }

            try
            {
                // toolbox
                AddRemoveItems AddRemoveItemsDlg = new AddRemoveItems(strAssemblyFiles);
                AddRemoveItemsDlg.RemoveItem();
                // license
                if (strAssemblyFiles.Contains("Core.dll"))
                {
                    rk.DeleteValue("GAC");
                    rk.DeleteValue("InstallPath");
                }
            }
            catch { };
            //                rk.DeleteSubKeyTree("Features");
            rk.Close();
            //            } catch {
            //            }
        }
Exemple #5
0
        public void RemoveAssembliesFromGac()
        {
#if NETFRAMEWORK
            var publish = new System.EnterpriseServices.Internal.Publish();

            var targetFolder = CustomTestFramework.GetProfilerTargetFolder();

            foreach (var file in Directory.GetFiles(targetFolder, "*.dll"))
            {
                publish.GacRemove(file);
            }
#endif
        }
Exemple #6
0
        private static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ShowError("引数が不正です。");
                return;
            }

            System.EnterpriseServices.Internal.Publish pub = new System.EnterpriseServices.Internal.Publish();
            if (args[0] == "/i")
            {
                try
                {
                    //GACにインストール
                    pub.GacInstall(args[1]);
                }
                catch
                {
                    ShowError("GACへのインストールに失敗しました。");
                    return;
                }
            }
            else if (args[0] == "/u")
            {
                try
                {
                    //GACからアンインストール
                    pub.GacRemove(args[1]);
                }
                catch
                {
                    ShowError("GACからのアンインストールに失敗しました。");
                    return;
                }
            }
            else
            {
                ShowError("引数が不正です。");
                return;
            }

            System.Environment.ExitCode = 0;
        }
Exemple #7
0
        public void Event()
        {
            System.EnterpriseServices.Internal.Publish foo = new
                                                             System.EnterpriseServices.Internal.Publish();
            string        folder = Settings1.Default.Folder;
            DirectoryInfo info   = new DirectoryInfo(folder);

            foreach (var item in info.GetFiles())
            {
                if (item.Extension.Equals(".dll") && !item.Name.Contains("Microsoft"))
                {
                    foo.GacRemove(item.FullName);
                    foo.GacInstall(item.FullName);
                }
                else
                {
                }
            }
        }
Exemple #8
0
 public static void GacUnInstall(string assemblyName)
 {
     System.EnterpriseServices.Internal.Publish gac = new System.EnterpriseServices.Internal.Publish();
     gac.GacRemove(assemblyName);
 }
 public override void Uninstall(IDictionary savedState)
 {
     base.Uninstall(savedState);
     System.EnterpriseServices.Internal.Publish pub = new System.EnterpriseServices.Internal.Publish();
     pub.GacRemove(Context.Parameters["DP_targetPath"].ToString() + "lib/Interop.SunVoteARS.dll");
 }
Exemple #10
0
        private static void Remove()
        {
            try
            {
                System.EnterpriseServices.Internal.Publish pub = new System.EnterpriseServices.Internal.Publish();
                pub.GacRemove(thispath + @"\QueryAnalyzer_DataProvider.dll");
                Console.WriteLine("QueryAnalyzer_DataProvider.dll is removed from gac.");

                {
                    Configuration c = ConfigurationManager.OpenMachineConfiguration();
                    string cpath = c.FilePath;
                    RemoveNode(cpath);

                    string cpath32 = GetConfigPath32(cpath);
                    if (cpath32 != null)
                    {
                        RemoveNode(cpath32);
                    }
                }            
            }
            catch (Exception e)
            {
                Console.WriteLine("Error occurred while uninstalling QueryAnalyzer_DataProvider.dll: {0}", e.ToString());
            }            
        }