新建项目:选择windows服务,自动生成 Service1 : ServiceBase
在Service1的设计视图,右键菜单-添加安装程序,生成ProjectInstaller : Installer
ProjectInstaller里自动添加了
        private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
        private System.ServiceProcess.ServiceInstaller serviceInstaller1;

serviceInstaller1:
  Description  获取或设置服务的说明。
  DisplayName  指示向用户标识服务的友好名称。
 ServiceName  指示系统用于标识此服务的名称。此属性必须与要安装的服务的 ServiceBase.ServiceName 相同。
  StartType    指示启动此服务的方式和时间。 (手工,自动,禁用)

serviceProcessInstaller1:
Account: -运行的帐户 LocalSystem

安装:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil your.exe
卸载:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\installutil /u your.exe

ps:没啥好写,记一点容易忘记的东西。添加安装程序这步就又找了好久。

相关文章:

  • 2021-11-20
  • 2021-09-18
  • 2021-05-17
  • 2021-05-22
猜你喜欢
  • 2022-02-05
  • 2021-07-06
  • 2022-12-23
  • 2021-04-15
  • 2021-11-03
  • 2019-03-20
相关资源
相似解决方案