.net WiX-安装Windows服务并授予权限

.net WiX-安装Windows服务并授予权限,.net,windows-services,wix,windows-installer,.net,Windows Services,Wix,Windows Installer,我们需要授予用户启动、停止和查询已安装服务状态的权限 在WiX 2.0中,此xml可以工作: <ServiceInstall Id="ServiceInstaller" Type="ownProcess" Name="$(var.ServiceName)" DisplayName="$(var.ServiceName)" Description="Our service description" Start="demand" Account="LocalSystem

我们需要授予用户启动、停止和查询已安装服务状态的权限

在WiX 2.0中,此xml可以工作:

<ServiceInstall
    Id="ServiceInstaller" Type="ownProcess"
    Name="$(var.ServiceName)" DisplayName="$(var.ServiceName)" Description="Our service description"
    Start="demand" Account="LocalSystem" ErrorControl="ignore" Interactive="no">
    <Permission User="Everyone" ServiceQueryStatus="yes" ServiceStart="yes" ServiceStop="yes" />
</ServiceInstall>
<ServiceControl Id="StopService" Stop="both" Remove="uninstall" Name="$(var.OmniVpnServiceName)" Wait="yes" />

我们使用的是WiX 3.0,他们从Permission元素中删除了Service*属性,不再允许它是ServiceInstall元素的子元素

我们如何在WIX3.0中获得相同的效果

总而言之,我们需要:

使用以下内容安装服务:

  • 手动启动
  • 在本地系统下作为“ownProcess”运行
  • 与桌面不交互
  • 卸载时停止
为“Everyone”用户提供以下访问权限:

  • 开始
  • 停止
  • 查询状态

在已安装的服务上。

文档说明在ServiceInstall元素中使用以下内容:

<util:PermissionEx
    User="Everyone"
    GenericAll="yes"
    ServiceChangeConfig="yes"
    ServiceEnumerateDependents="yes"
    ChangePermission="yes"
    ServiceInterrogate="yes"
    ServicePauseContinue="yes"
    ServiceQueryConfig="yes"
    ServiceQueryStatus="yes"
    ServiceStart="yes"
    ServiceStop="yes" />

我还没试过


util名称空间是
xmlns:util=”http://schemas.microsoft.com/wix/UtilExtension“

您可以发布您正在查看的文档的链接吗?我一直在访问wix.sourceforge.net,但很多东西都缺少它。事实上,在一个论坛中,如果你想进一步挖掘,看看还能找到什么黄金,这里有一个链接:我使用每个构建中提供的wix.chm。它的索引和搜索为我快速找到答案。要使响应完整,请记住添加对WixUtilsExtension的引用。dll@SzymonSasin:要引用的dll的正确名称为WixUtilExtension.dll