Wix 安装程序失败"Verify that you have sufficient privileges to start system services"



我正在尝试创建一个wix安装程序,我需要它来提示管理员用户名和密码,但我无法显示弹出窗口。我已尝试更改InstallPrivileges、InstallScope,以及从ServiceInstall更改和删除帐户。我如何才能让管理员弹出窗口显示或绕过它?

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject2" Language="1033" Version="1.0.0.0" Manufacturer="test" UpgradeCode="3a34bc81-42fa-4c8f-b485-cf2297551f86">
<Package InstallerVersion="301" Compressed="yes" InstallPrivileges="elevated" InstallScope="perMachine"  />

<Condition Message="Please Run as Administrator.">
Privileged
</Condition>
<MediaTemplate EmbedCab="yes" />

<Feature Id="ProductFeature" Title="SetupProject2" Level="1">
<ComponentGroupRef Id="CG_DependencyFiles" />
<ComponentGroupRef Id="CG_ServiceInstaller" />
</Feature>
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject2" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="CG_DependencyFiles" Directory="INSTALLFOLDER">
//All my dll 
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="CG_ServiceInstaller" Directory="INSTALLFOLDER">
<Component Guid="F7E041AB-3227-4272-92C1-4A12685F30AF" >
<File Source="$(var.myTestService.TargetDir)myTestService.exe" KeyPath="yes"/>
<ServiceInstall Id="myTestService"
Type="ownProcess"
Name="myTestService"
DisplayName="myTestService"
Description="Super awesome service"
Start="auto"
ErrorControl="normal"
/>
<ServiceControl Id="StartService" Start="install" Stop="both" Remove="uninstall" Name="myTestService" Wait="yes" />
</Component>
</ComponentGroup>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
<Component Id="ProductComponent">
<File Source="$(var.myTestService.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>

尝试将UI添加到安装中,如:<UIRef Id="WixUI_Minimal" />。拥有UI并在UI模式下启动安装(双击即可(应允许Windows安装程序在您点击Install按钮时提示提升。

相关内容

最新更新