• 注册和卸载COM


    /// <summary>
           
    /// 注册COM+
           
    /// </summary>
           
    /// <param name="assembly"></param>
           
    /// <param name="strErrorMessage"></param>
           
    /// <returns></returns>
           public static bool Install(string assembly, ref string strErrorMessage)
           {
               bool flag = true;
               string applicationName = string.Empty;
               string typeLibraryName = string.Empty;
               try
               {
                   flag = true;
                   RegistrationHelper helper = new RegistrationHelper();
                   helper.InstallAssembly(assembly, ref applicationName, ref typeLibraryName, InstallationFlags.CreateTargetApplication);
                   strErrorMessage = string.Empty;
               }
               catch (Exception ex)
               {
                   flag = false;
                   strErrorMessage = ex.Message;
                   //throw;
               }
               return flag;
           }


           /// <summary>
           
    /// 卸栽COM+
           
    /// </summary>
           
    /// <param name="assembly"></param>
           
    /// <param name="strErrorMessage"></param>
           
    /// <returns></returns>
           public static bool UnInstall(string assembly, ref string strErrorMessage)
           {
               bool flag = true;
               string applicationName = string.Empty;
               string typeLibraryName = string.Empty;
               try
               {
                   flag = true;
                   RegistrationHelper helper = new RegistrationHelper();
                   helper.UninstallAssembly(assembly,  applicationName,  typeLibraryName);
                   strErrorMessage = string.Empty;
               }
               catch (Exception ex)
               {
                   flag = false;
                   strErrorMessage = ex.Message;
                   //throw;
               }
               return flag;
           }
        } 

      
  • 相关阅读:
    [论文阅读]VERY DEEP CONVOLUTIONAL NETWORKS FOR LARGE-SCALE IMAGE RECOGNITION(VGGNet)
    VMware虚拟机 Ubuntu 实用技巧 (1) -- 安装VMware Tool
    python 开发技巧(4)-- 用PyCharm实用技巧(我自己常用的)
    python 开发技巧(3)-- 连接mysql 出现错误 ModuleNotFoundError: No module named 'MySQLdb'
    python 开发技巧(2)-- Django的安装与使用
    Linux netstat命令
    RabbitMQ(一):Windows下RabbitMQ安装
    python 开发技巧(1)-- 用PyCharm安装第三方库
    Swoole系列(三):建立TCP服务器并发送数据测试
    Swoole系列(二):安装
  • 原文地址:https://www.cnblogs.com/51net/p/2537872.html
Copyright © 2020-2023  润新知