if (args.Length == 0)
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[] { new MyService1() };
ServiceBase.Run(ServicesToRun);
}
else if (args[0].ToLower() == "/i" || args[0].ToLower() == "-i")
{
try
{
string[] cmdline = { };
string serviceFileName = System.Reflection.Assembly.GetExecutingAssembly().Location; TransactedInstaller transactedInstaller = new TransactedInstaller();
AssemblyInstaller assemblyInstaller = new AssemblyInstaller(serviceFileName, cmdline);
transactedInstaller.Installers.Add(assemblyInstaller);
transactedInstaller.Install(new System.Collections.Hashtable());
}
catch (Exception ex)
{
string msg = ex.Message;
}
}
else if (args[0].ToLower() == "/u" || args[0].ToLower() == "-u")
{
try
{
string[] cmdline = { };
string serviceFileName = System.Reflection.Assembly.GetExecutingAssembly().Location; TransactedInstaller transactedInstaller = new TransactedInstaller();
AssemblyInstaller assemblyInstaller = new AssemblyInstaller(serviceFileName, cmdline);
transactedInstaller.Installers.Add(assemblyInstaller);
transactedInstaller.Uninstall(null);
}
catch (Exception ex)
{
string msg = ex.Message;
}
}

  

installer的更多相关文章

  1. Windows Installer 服务启动错误 14007 的解决办法

    问题: 在 本地计算机 无法启动 Windows Installer 服务. 错误代码 14007: 在活动的激活上下文中没有找到任何查找密钥. 这个问题似乎涉及到 Windows Installer ...

  2. visual studio installer 打包123

    下载安装visual studio installer

  3. 关于SQL Server 安装程序在运行 Windows Installer 文件时遇到错误

    前几日安装sql server2008r2 的时候碰到这个问题: 出现以下错误: SQL Server 安装程序在运行 Windows Installer 文件时遇到错误. Windows Insta ...

  4. Visual Studio 2015 Pre Secondary Installer 在哪里

    安装vs2015 pre后,会自动打开Secondary Installer, 用于Cross Platform的移动开发框架,包括Cordova插件.若安装失败,启动程序位置: "D:\P ...

  5. 解决ArcGIS安装之后出现的Windows installer configures问题

    ----Please wait while Windows installer configures ArcGIS Desktop Error Message错误信息 When launching A ...

  6. Microsoft Web Platform Installer 5.0

    Microsoft Web Platform Installer 5.0 Web 平台安装器 https://www.microsoft.com/web/downloads/platform.aspx

  7. 用Advanced Installer制作DotNetBar for Windows Forms 12.0.0.1_冰河之刃重打包版详解

    关于 DotNetBar for Windows Forms 12.0.0.1_冰河之刃重打包版 --------------------11.8.0.8_冰河之刃重打包版-------------- ...

  8. 使用Qt installer framework制作安装包

    一.介绍 使用Qt库开发的应用程序,一般有两种发布方式:(1)静态编译发布.这种方式使得程序在编译的时候会将Qt核心库全部编译到一个可执行文件中.其优势是简单单一,所有的依赖库都集中在一起,其缺点也很 ...

  9. 【工具】清理Windows Installer冗余文件(支持64位NT6.x系统)

    样子: 支持系统: Windows NT 5.x/6.x 32及64位所有系统.需.net framework 2.0运行环境 功能: 清理上述系统中冗余的Windows Installer补丁文件. ...

  10. VS2015 Preview Secondary Installer 离线安装

    VS2015 Preview Secondary Installer 离线安装 天朝的原因orz, 装过vs2015 preview 的人都懂的,第二阶段安装会失败.假公济私的研究了下VS2015,摸 ...

随机推荐

  1. bzoj5461 Minimax 题解

    https://www.lydsy.com/JudgeOnline/problem.php?id=5461 看到题目,必将m种权值离散化. 首先是一个显然的dp设计. 设$f(i,j)$表示第i个节点 ...

  2. 作业:IEEE754浮点数

    人工转换: 5.75转换成二进制:101.11右移2位,补0:1.0111000000000000000000000000000000000000000000000000.10000000001 16 ...

  3. 2018ECNA Difference[时空复杂度]

    目录 题干 代码和解释 题干 代码和解释 本题给出一个数列的第一个数A(1),要求找出m第一次出现(直接出现在数列中或是数列中某两项的差的绝对值)在这个数列的第几步中.数列递推公式:A(n+1)=A( ...

  4. 自顶向下深入分析Netty(六)--Channel总述

    自顶向下深入分析Netty(六)--Channel总述 自顶向下深入分析Netty(六)--Channel源码实现 6.1 总述 6.1.1 Channel JDK中的Channel是通讯的载体,而N ...

  5. java SDK服务端推送 --极光推送(JPush)

    网址:https://blog.csdn.net/duyusean/article/details/86581475 消息推送在APP应用中越来越普遍,来记录一下项目中用到的一种推送方式,对于Andr ...

  6. Torch-Models 别人训练的FastNeuralStyle

    This is the pink style's image: This is the triangle one: The fire ones come from this image: And th ...

  7. redhat 6安装python 3.7.4报错ModuleNotFoundError: No module named '_ctypes' make: *** [install] Error 1

    问题描述: 今天在测试环境中,为了执行脚本,安装下python3命令,在执行make install的时候报错: ModuleNotFoundError: No module named '_ctyp ...

  8. linux安装nvm和nodejs

    下载nvm包: [root@centos ~]# wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install ...

  9. cp复制

    将Data文件复制到B目录下: cp -r /home/hp/Data /home/hp/B/  

  10. 关于怎么提取m3u8地址

    摘自: https://blog.51cto.com/4373601/1920758 很长时间没有写博客了,这一段时间比较忙,接下来的日子要坚持写博客了,后期抽空会把这一年多的测试心得补上来,写博客其 ...