简体   繁体   English

使用 WIX 安装程序未正确安装服务

[英]Service not being installed properly using WIX installer

As the title says, I am have the following snippet of a code that installs a service using wix正如标题所说,我有以下代码片段,它使用 wix 安装服务

<Directory Id="Test" Name="Test">
        <Component Id="ConnectorMainService" Guid="{SOME-ID}">
          <CreateFolder/>
          <ServiceInstall Id="ServiceInstaller" Type="ownProcess" Name="$(var.PRODUCT_NAME)" DisplayName="$(var.PRODUCT_NAME)" Description="$(var.DESCRIPTION)" Start="auto" Account="NT AUTHORITY\LocalService" ErrorControl="normal" Interactive="no" Vital="yes"/>
              <ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="$(var.PRODUCT_NAME)" Wait="yes"/>
        </Component>
</Directory>

I had to put a <CreateFolder> in there, otherwise I have the same issues as described in this question ( Why does my WiX installer need an empty CreateFolder to conditionally update an Xml file? ).我必须在其中放一个 <CreateFolder> ,否则我会遇到与此问题中描述的相同的问题( 为什么我的 WiX 安装程序需要一个空的 CreateFolder 来有条件地更新 Xml 文件? )。

The difference I have is even having the <CreateFolder> there, the installer exits without creating the service, it just creates the Folder.我所拥有的不同之处甚至是 <CreateFolder> 在那里,安装程序退出而不创建服务,它只是创建文件夹。

Replace the CreateFolder element with a File element for the service executable itself.CreateFolder元素替换为服务可执行文件本身的File元素。 The Windows Installer requires the service's executable File and ServiceInstall elements to be in the same Component (specifically, the service executable must be the KeyPath of the Component but WiX will take care of that for you if you put the executable File element first in the Component ). Windows 安装程序要求服务的可执行FileServiceInstall元素位于同一个Component中(具体来说,服务可执行文件必须是ComponentKeyPath ,但 WiX 会为您处理,如果您将可执行File元素放在Component中的第一位)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM