C# 实现安装C#写的系统服务 不依赖InstallUtil
来源:互联网 发布:linux squid 编辑:程序博客网 时间:2024/06/15 13:34
反编译的 InstallUtil
/// <summary> /// 安装服务 /// using System.Configuration.Install /// </summary> /// <param name="AssemblyFile">程序集</param> /// <param name="Install">true 安装 false 卸载</param> public void InstallServer(String AssemblyFile,Boolean Install = true) { TransactedInstaller transactedInstaller = new TransactedInstaller(); List<String> arrayList = new List<String>(); Assembly assembly = null; //arrayList.Add("/LogToConsole=false"); //XXServer, Version=3.425.2015.320, Culture=neutral, PublicKeyToken=null if (AssemblyFile.Contains("Version") && AssemblyFile.Contains("Culture") && AssemblyFile.Contains("PublicKeyToken")) { assembly = Assembly.Load(AssemblyFile); } else { assembly = Assembly.LoadFrom(AssemblyFile); } AssemblyInstaller value = new AssemblyInstaller(assembly, arrayList.ToArray()); transactedInstaller.Installers.Add(value); transactedInstaller.Context = new InstallContext("log.txt", arrayList.ToArray()); try { IDictionary stateSaver = new Hashtable(); transactedInstaller.Install(stateSaver); transactedInstaller.Uninstall(null); } catch (Exception ex) { Console.WriteLine(ex); } }
阅读全文
0 0
- C# 实现安装C#写的系统服务 不依赖InstallUtil
- 转:使用C#代码安装 Windows 服务(不使用InstallUtil)
- 使用C#代码安装 Windows 服务(不使用InstallUtil) (转帖)
- C#程序安装.net服务(不使用InstallUtil.exe)
- 使用C#代码安装 Windows 服务(不使用InstallUtil)
- C#程序安装.net服务(不使用InstallUtil.exe)
- [转]C#程序安装.net服务(不使用InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- C# windows服务:通过cmd命令安装、卸载、启动和停止Windows Service(InstallUtil.exe)
- [转贴]写自动安装的Windows服务(不需要安装命令InstallUtil)
- InstallUtil安装Windows服务
- InstallUtil安装服务失败
- c# 创建Windows服务( Installutil .exe方式加载 )
- c# 系统服务程序安装
- c#写的Windows服务创建及安装
- [Oracle 11g r2 (11.2.0.4.0) ]设置共享服务连接方式
- 记一次ubuntu连上校园网但不能浏览网页
- 从零开始安装使用ceph
- 请描述MySql从安装到配置的全部详细过程(确保一台新电脑可以顺利使用mysql)
- springMvc注解@ControllerAdvice,@InitBinder,@CrossOrigin,@CookieValue
- C# 实现安装C#写的系统服务 不依赖InstallUtil
- 三分钟掌握数据中心“容灾和备份的区别”
- 用python的画表格
- 所谓的沉浸式状态栏---
- 阿里再推内置锂电池服务器 Facebook等国际巨头也上马相关技术
- springMVC入门--3.数据校验
- 从好耶牵手海航集团看海航集团怎么样
- 应工程师需求,今天来盘点一下常见总线类型(干货版)
- 计蒜课:泥塑课