如何使用WiX安装程序使用提升的权限进行安装?

Jon*_*sie 13 wix

我们目前有一个使用WiX 3.5 创建的MSI .该应用程序在.NET 3.5中.我们使用MSBuild文件中的boostrapper任务生成一个bootstrapper .它指向6.0a SDK文件.

当用户启用UAC并进行安装时,他们必须右键单击setup.exe并选择run-as管理员.

我真正想要的是让setup.exe自动提示提升(使用我在其他安装中看到的黄色对话框).

更好的是,我希望MSI能够做到这一点并完全取消它setup.exe,但我认为这就是WiX 3.6的用途,对吧?

如果我使用ApplicationRequiresElevation="true"这个需求创建了boostperper 7.0a SDK,对吗?然后引导程序会提示自动提升吗?这是否意味着应用程序必须是.NET 4应用程序?我不这么认为......

Jas*_*own 15

我们使用过WiX 3.0并且能够提升特权.但是,我们没有提升我们的引导程序.我们通过Package属性提升了MSI文件本身:

<Package Id="$(var.PackageCode)"
         Description="$(var.ProductName) $(var.Version)"
         InstallerVersion="301"
         Compressed="yes"
         InstallPrivileges="elevated"  <!-- Elevated right here -->
         InstallScope="perMachine"
         Platform="x86"/>
Run Code Online (Sandbox Code Playgroud)

作为旁注,我们的引导程序使用我们的官方证书进行签名(使用v6.0A SDK中的signtool.exe).我不确定这是否会导致引导程序也需要提升权限.

更新:

我们的setup.exe bootstrapper项目上有一个app.manifest文件,要求在管理员级别运行可执行文件.请参阅以下示例:

<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"
                xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
                xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
    <security>
      <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace
            the requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            If you want to utilize File and Registry Virtualization for backward
            compatibility then delete the requestedExecutionLevel node.
        -->
        <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</asmv1:assembly>
Run Code Online (Sandbox Code Playgroud)