WIX服务安装程序将覆盖服务安装程序设置 [英] WIX service installer overrides service Installer settings

查看:62
本文介绍了WIX服务安装程序将覆盖服务安装程序设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一项服务,该服务后来由WIX安装程序部署.这是服务安装程序类

  this.ServiceInstaller.DisplayName =我的服务";this.ServiceInstaller.ServiceName ="MyService";this.ServiceInstaller.ServicesDependedOn =新字符串[] {"ServiceA","ServiceB","ServiceC"}; 

这是WIX安装程序代码

 < Component Id ="MyService.exe" Guid ="{1234}"><文件Id ="MyService.exe" KeyPath ="yes" Source ="$ system \ $(sys.BUILDARCH)\ MyService.exe">< netfx:NativeImage Id ="MyService.exe" Platform ="all" Priority ="1"/></文件>< ServiceInstall Id ="MyService.exe" DisplayName =我的其他服务" Name ="MyService" ErrorControl ="normal" Start =自动" Type ="ownProcess">< ServiceDependency Id ="ServiceD"/>< ServiceDependency Id ="ServiceE"/>< ServiceDependency Id ="ServiceF"/>< util:ServiceConfig FirstFailureActionType ="restart" SecondFailureActionType ="restart" ThirdFailureActionType ="restart" RestartServiceDelayInSeconds ="10"/></ServiceInstall>< ServiceControl Id ="MyService.exe" Name ="MyService" Stop ="install" Remove =卸载"/></Component> 

据我所知,

在WIX中的配置完全覆盖了项目安装程序中的设置.(特别是名称和依赖项)这是默认行为吗?如果WIX要完全忽略它,那么有一个serviceInstaller类有什么意义呢?

解决方案

交叉链接 :几个支持的答案: 1) Chris Painter关于服务凭证保存和/或处理的问题 2) "Windows安装程序权威指南" )列出了通过以下方式安装服务的多种方式:

  • 1) MSI - ServiceInstall ServiceControl 表-以及其他一些表.
  • 2) Win32 - CreateService API.
  • 3) 注册表 -手动更新,通常不受欢迎.选项.
  • 4) WMI类 - Win32_Service >.主要优点:可编写脚本.包装 CreateService (Win32).
  • 5) InstallUtil.exe -.NET工具&安装程序类.
  • 6) MSI&安装程序类自定义操作 -通过shim dll InstallUtilLib.Dll 调用 InstallUtil.exe 在Visual Studio安装项目中显示"strong>"-不是我的最喜欢的选项.基本上没有任何收获的许多复杂性.只需使用MSI中的服务表即可.自动魔术师.

InstallUtil.exe :. NET到来时,在.NET框架中引入了一个名为InstallUtil.exe的工具以及一组安装程序类.ServiceInstaller框架类包含用于安装Services的代码,开发人员可以覆盖类方法以提供额外的安装时代码.这为开发人员提供了一种有用的方法,可以方便地安装Services进行测试.


很多年后,可以将其添加到Phil的列表中:

更具异国情调:Srvany(将应用程序作为服务运行,非常陈旧-请勿使用).


Windows服务常见问题(FAQ): https://www.coretechnologies.com/WindowsServices/FAQ.html

i am working on a service that is later deployed by a WIX installer. this is service installer class

this.ServiceInstaller.DisplayName = "My Service";
            this.ServiceInstaller.ServiceName = "MyService";
            this.ServiceInstaller.ServicesDependedOn = new string[] {
        "ServiceA",
        "ServiceB",
        "ServiceC"};

and this is the WIX installer code

    <Component Id="MyService.exe" Guid="{1234}">
        <File Id="MyService.exe" KeyPath="yes" Source="$system\$(sys.BUILDARCH)\MyService.exe">
          <netfx:NativeImage Id="MyService.exe" Platform="all" Priority="1" />
        </File>
        <ServiceInstall Id="MyService.exe" DisplayName="My OTHER Service" Name="MyService" ErrorControl="normal" Start="auto" Type="ownProcess">
          <ServiceDependency Id="ServiceD" />
          <ServiceDependency Id="ServiceE" />
          <ServiceDependency Id="ServiceF" />
          <util:ServiceConfig FirstFailureActionType="restart" SecondFailureActionType="restart" ThirdFailureActionType="restart" RestartServiceDelayInSeconds="10" />
        </ServiceInstall>
        <ServiceControl Id="MyService.exe" Name="MyService" Stop="install" Remove="uninstall" />
    </Component>

as far as i can tell, the configuration in the WIX completely overrides the settings in the project installer. (specifically name and dependencies) is this a default behavior? whats the point of having a serviceInstaller class if WIX is going to completely ignore it?

解决方案

Cross Linking: A couple of supporting answers: 1) Chris Painter on service credential preservation and / or handling, 2) Service debugging.


ServiceInstaller classes: This feature is generally meant to be used during development for testing purposes. You use the InstallUtil.exe .NET tool for installation and / or Visual Studio.


Prefer MSI: There are many ways to install services, but you should use the MSI tables ServiceInstall and ServiceControl if you can. Below are some further details on various more or less crazy options.


Service Registration Options: An old, classic document from Phil Wilson (MSI MVP and author of "The Definitive Guide to Windows Installer") listed a number of ways to install services by means of:

  • 1) MSI - ServiceInstall, ServiceControl tables - and a few others.
  • 2) Win32 - CreateService APIs.
  • 3) Registry - manually update, generally an undesirable "under-the-hood" option.
  • 4) WMI Classes - Win32_Service. Major benefit: Scriptable. Wraps CreateService (Win32).
  • 5) InstallUtil.exe - .NET tool & installer classes.
  • 6) MSI & Installer Class Custom Actions - calls InstallUtil.exe via the shim dll InstallUtilLib.Dll in Visual Studio Setup Projects - not a favorite option of mine. A lot of complexity for no gain basically. Just use the service tables in the MSI. Automagic.

InstallUtil.exe: When .NET arrived, a tool called InstallUtil.exe was introduced together with a set of installer classes in the .NET framework. The ServiceInstaller framework class contains code to install Services, and the developer can override the class methods to provide extra install-time code. This provides a useful way for developers to easily install Services for testing purposes.


Many years later one could add to Phil's list:

More exotic: Srvany (run app as service, very outdated - don't use).


Windows Services Frequently Asked Questions (FAQ): https://www.coretechnologies.com/WindowsServices/FAQ.html

这篇关于WIX服务安装程序将覆盖服务安装程序设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆