windows - 使用 WIX 注册带有参数的 Windows 服务

标签 windows service parameters wix

我想使用 WIX 创建一个 Windows 服务并为该服务设置一些参数(不是参数)。我指的是出现在 System->[X]ControlSet->[Service Name]->Parameters 下的参数。 任何人都知道我该怎么做? 谢谢。

最佳答案

我通过手动添加我需要的注册表值来做到这一点,它工作正常:

<Component Id="NSSM" Guid="[MYGUID]">
  <File Id="NSSM" Name="nssm.exe" Source="nssm.exe" />
  <ServiceInstall Id="RenderSvc" Name="Render" DisplayName="Render" Type="ownProcess" Start="auto" ErrorControl="normal" />
  <RegistryKey Root="HKLM" Key="SYSTEM\CurrentControlSet\Services\Render\Parameters">
     <RegistryValue Name="AppDirectory" Value="[F_ROOT]bin" Type="expandable" />
     <RegistryValue Name="Application" Value="[F_BIN]render.exe" Type="expandable" />
     <RegistryValue Name="AppParameters" Value="" Type="expandable" />
     <RegistryKey Key="AppExit">
        <RegistryValue Value="Restart" Type="string" />
     </RegistryKey>
  </RegistryKey>
  <ServiceControl Id="RenderSvc" Name="Render" Start="install" Stop="both" />
</Component>

在 Orca 中检查生成的 msi 文件后,我认为它在创建服务之前创建注册表值。最好在创建后立即执行此操作,但它对我有用,所以我就到此为止了。

关于windows - 使用 WIX 注册带有参数的 Windows 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6826726/

相关文章:

c - Windows API 使用

service - 如何编辑 Kubernetes ServiceAccount 的命名空间

windows - 从另一个线程调用 OpenGL 函数

c# - 通过 C# 确定本地组的成员

android - 一项服务允许多个 Activity 的位置更新

javascript - 如何将表格行解析为 JS 函数 onClick 的参数?

vb.net - 操作数类型冲突 : nvarchar is incompatible with image

powershell - 通过动态变量名获取变量

RubyMine - 没有为项目配置 Ruby 解释器

Android:检查 Activity 是否被系统从服务中销毁