首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Wix回滚静音执行自定义操作不起作用

Wix回滚静音执行自定义操作不起作用
EN

Stack Overflow用户
提问于 2014-08-28 15:45:09
回答 1查看 857关注 0票数 1

我想安装并启动Redis (for Windows)作为我们软件包的一部分。服务的安装和启动工作正常,但在安装过程中会发生错误,然后是回滚,而服务在回滚后不会被删除。

有人能帮我找出我做错了什么吗?另外,我是否也需要单独的删除命令,还是回滚也适用于卸载?

(像#fil5E85DBB2FFC8A8CFA55EDCADD8376C1F这样的值是使用HeatDirectory为redis-server.exe及其目录生成的Id)

代码语言:javascript
复制
<!--Install Redis-->
<CustomAction Id="SetRedisInstall"
              Property="RedisInstall"
              Value="&quot;[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]&quot; --service-install &quot;[dir13BD3F7531FC8E0F30BB51FAA1B1357F]redis.windows.conf&quot; --loglevel verbose" />
<CustomAction Id="RedisInstall"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec"
              Execute="deferred"
              Return="check"
              Impersonate="no"/>
<CustomAction Id="SetRedisStart" Property="RedisStart" Value="&quot;[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]&quot; --service-start" />
<CustomAction Id="RedisStart"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec"
              Execute="deferred"
              Return="check"
              Impersonate="no"/>

<!--Rollback Redis-->
<CustomAction Id="SetRedisStop" Property="RedisStop" Value="&quot;[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]&quot; --service-stop" />
<CustomAction Id="RedisStop"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec"
              Execute="rollback"
              Return="ignore"
              Impersonate="no"/>
<CustomAction Id="SetRedisRemove" Property="RedisRemove" Value="&quot;[#fil5E85DBB2FFC8A2CFA55EDCADD8376C1F]&quot; --service-uninstall" />
<CustomAction Id="RedisRemove"
              BinaryKey="WixCA"
              DllEntry="CAQuietExec"
              Execute="ignore"
              Return="asyncWait"
              Impersonate="no"/>

<InstallExecuteSequence>
  <!--Install Redis-->
  <Custom Action="RedisInstall" Before="InstallFinalize">Not Installed</Custom>
  <Custom Action="SetRedisInstall" Before="RedisInstall">Not Installed</Custom>
  <Custom Action="RedisStart" After="RedisInstall">Not Installed</Custom>
  <Custom Action="SetRedisStart" Before="RedisStart">Not Installed</Custom>
  <!--Rollback Redis-->
  <Custom Action="SetRedisStop" Before="RedisStop"></Custom>
  <Custom Action="RedisStop" Before="RedisStart"></Custom>
  <Custom Action="RedisRemove" Before="RedisInstall"></Custom>
  <Custom Action="SetRedisRemove" Before="RedisRemove"></Custom>
</InstallExecuteSequence>

编辑我有这个组件

代码语言:javascript
复制
<Feature Id="Redis" Title="Redis" Level="1" >
  <ComponentGroupRef Id="RedisWxs"/>
</Feature>

现在服务部分也是:

代码语言:javascript
复制
<ServiceInstall Id="siRedisService" Description="Redis Service" DisplayName="Redis" Arguments="&quot;[dir13BD3F7531FC8E0F30BB51FAA1B1357F]redis.windows.conf&quot;" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NetworkService"/>
<ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />

如何将服务添加到现有组件中?

编辑2

我已经禁用了自动采集和编辑输出文件,以解决引用问题。我仍然有一个问题,那就是Redis服务无法启动。但是,当我将路径(包括配置文件)复制到cmd中时,它的工作非常好……

这是密码

代码语言:javascript
复制
        <Component Id="cmp911C50BAA696496834114926A958787D" Guid="*">
            <File Id="fil5E85DBB2FFC8A2CFA55EDCADD8376C1F" KeyPath="yes" Source="$(var.RedisPath)\redis-server.exe" />
            <ServiceInstall Id="siRedisService" DisplayName="Redis" Arguments="--service-run redis.windows.conf --loglevel verbose" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NetworkService"/>
            <ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />
        </Component>
        <Component Id="cmpFC38C2953561FABFFCF29CCEC52692E1" Guid="*">
            <File Id="filF5607FB03CD4B203C699DA14D17FF53B" KeyPath="yes" Source="$(var.RedisPath)\redis.windows.conf" />
        </Component>

编辑3-工作解决方案

有一个许可问题,我就是这样解决的:

代码语言:javascript
复制
        <Component Id="cmp911C50BAA696496834114926A958787D" Guid="*">
            <File Id="fil5E85DBB2FFC8A2CFA55EDCADD8376C1F" KeyPath="yes" Source="$(var.RedisPath)\redis-server.exe" />
            <CreateFolder Directory="dir13BD3F7531FC8E0F30BB51FAA1B1357F">
              <util:PermissionEx User="NT AUTHORITY\NETWORKSERVICE" GenericAll="yes" />
            </CreateFolder>
            <ServiceInstall Id="siRedisService" DisplayName="Redis" Arguments="--service-run &quot;[#filF5607FB03CD4B203C699DA14D17FF53B]&quot;" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NETWORKSERVICE"/>
            <ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />
        </Component>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-28 17:37:29

这确实是很多定制动作。我会把他们赶走的。以下是我的滚动方式:

代码语言:javascript
复制
<Component Id="redacted" Guid="redacted">
  <File Id="redacted" Source="$(var.SourceDir)\redis-server.exe" KeyPath="yes" />
  <ServiceInstall Id="siRedisService" Description="Redis Service" DisplayName="Redis" Arguments="--service-run redis.windows.conf --loglevel verbose" ErrorControl="normal" Name="Redis" Start="auto" Type="ownProcess" Vital="yes" Account="NT AUTHORITY\NetworkService"/>
  <ServiceControl Id="scRedisService" Name="Redis" Start="install" Stop="both" Remove="both" Wait="yes" />
</Component>
<Component Id="redacted" Guid="redacted">
  <File Id="redacted" Source="$(var.SourceDir)\redis.windows.conf" KeyPath="yes" />
</Component>

我以前说过很多次了.服务就是服务。除了ServiceInstall和ServiceControl之外的其他任何东西,以及偶尔的注册表条目,都是一种自我注册反模式疯狂的形式。服务可以用不同的语言编写,并由不同的运行时托管,但是它们与服务控制管理器API的交互都是相同的,一旦解决了这些细节,MSI就可以本机处理它。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25552918

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档