【发布时间】:2019-01-17 00:02:55
【问题描述】:
我正在尝试使用 WiX 为窗口服务创建安装程序,我尝试了我找到的所有答案,但没有任何结果。使用 WiX 创建的安装程序仍然无法安装,因为权限,权限不足...这是我的代码...
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util='http://schemas.microsoft.com/wix/UtilExtension'><?define G_TargetDir=$(var.G.TargetDir)?>
<Product Id="*" Name="G.Installer" Language="1033" Version="1.0.0.0" Manufacturer="" UpgradeCode="PUT-GUID-HERE">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="G.Installer" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="G.Installer" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="G.exe" Guid="*">
<File Id="G.exe" Name="G.exe" Source="$(var.G_TargetDir)G.exe" Vital="yes" KeyPath="yes" />
<ServiceInstall Id="G.exe" Type="ownProcess" Vital="yes" Name="G.exe" DisplayName="G" Description="Description" Start="auto" Account="LocalSystem" ErrorControl="critical" Arguments="-start" Interactive="yes">
<util:PermissionEx User="Everyone" ServicePauseContinue="yes" ServiceQueryStatus="yes" ServiceStart="yes" ServiceStop="yes" ServiceUserDefinedControl="yes" />
</ServiceInstall>
<ServiceControl Id="G.exe" Stop="both" Start="install" Remove="uninstall" Name="G.exe" Wait="no"/>
</Component>
<Component Id="G.exe.config" Guid="*">
<File Id="G.exe.config" Name="G.exe.config" Source="$(var.G_TargetDir)G.exe.config" />
</Component>
<Component Id="MongoDB.Bson.dll" Guid="*">
<File Id="MongoDB.Bson.dll" Name="MongoDB.Bson.dll" Source="$(var.G_TargetDir)MongoDB.Bson.dll" />
</Component>
<Component Id="System.Buffers.dll" Guid="*">
<File Id="System.Buffers.dll" Name="System.Buffers.dll" Source="$(var.G_TargetDir)System.Buffers.dll" />
</Component>
<Component Id="DnsClient.dll" Guid="*">
<File Id="DnsClient.dll" Name="DnsClient.dll" Source="$(var.G_TargetDir)DnsClient.dll" />
</Component>
<Component Id="System.Runtime.InteropServices.RuntimeInformation.dll" Guid="*">
<File Id="System.Runtime.InteropServices.RuntimeInformation.dll" Name="System.Runtime.InteropServices.RuntimeInformation.dll" Source="$(var.G_TargetDir)System.Runtime.InteropServices.RuntimeInformation.dll" />
</Component>
<Component Id="MongoDB.Driver.Core.dll" Guid="*">
<File Id="MongoDB.Driver.Core.dll" Name="MongoDB.Driver.Core.dll" Source="$(var.G_TargetDir)MongoDB.Driver.Core.dll" />
</Component>
<Component Id="MongoDB.Driver.dll" Guid="*">
<File Id="MongoDB.Driver.dll" Name="MongoDB.Driver.dll" Source="$(var.G_TargetDir)MongoDB.Driver.dll" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
【问题讨论】:
-
请附上错误信息的全文。
-
以管理员身份运行安装程序是否有效?如果是,这可能会有所帮助 - stackoverflow.com/questions/14348156/…
-
在尝试其他任何事情之前,您能否将Package element的
InstallPrivileges attribute设置为"elevated"?
标签: xml service wix windows-services