本文介绍了WIX Burn Bootstrapper 不要求我的 MSI 的管理员权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 WIX 创建了一个需要提升权限才能正常工作的 MSI.在MSI项目中,我通过

I created an MSI with WIX that needs elevated permissions to work correctly. In the MSI Project, I specified this via

<Package [...] InstallPrivileges="elevated" />

现在我将此 MSI 包含在基于 WixWPF Bootstrapper 的自定义引导程序项目中.据我了解,引导程序本身不应改变机器状态,因此不应要求提升权限.

Now I included this MSI in a custom bootsrapper project, based on WixWPF Bootstrapper.As I understand it, the bootstrapper itself should not alter the machine state and thus should not require elevated privileges.

我现在希望 Bootstrapper 自动启动具有提升权限的集成 MSI,并在必要时通过 UAC 对话框提示用户.但事实并非如此.相反,安装只是失败.但是,当我以管理员身份显式运行引导程序可执行文件时,它可以工作.

I would now expect the Bootstrapper to automatically launch the integrated MSI with elevated priviliges, prompting the user with a UAC dialog, if necessary. But it does not. Instead, the installation just fails.It works however, when I run the bootstrapper executable explicitly as administrator.

如何让引导程序在安装 MSI 时请求提升权限?

How do I make the bootstrapper ask for elevated permissions when installing the MSI?

推荐答案

自从 INSTALLSCOPE 属性,它默认为每用户安装,引导程序认为它不需要任何管理员/提升权限来运行它.

Since the INSTALLSCOPE attribute for the MSI was not set, it defaulted to Per-User install and the bootstrapper application considered that it does not need any ADMIN/Elevated rights to run it.

现在,在您的情况下,您是 MSI 的作者,您很容易将 InstallScope 添加到包元素.

Now in your case, you are the author of the MSI and it was easy enough for you to add the InstallScope to the package element.

InstallScope="perMachine"

如果您不是 MSI 的作者,bootstrapper 仍然提供了一个属性,您可以使用它来强制 MSI/EXE 的每台机器.

If you are not the author of the MSI, still bootstrapper provides a property which you can use to force the per-machine for the MSI/EXE.

  1. MSIPackage - ForcePerMachine
  2. EXEPackage - PerMachine

那么为什么 Bootstrapper 认为 Per-Machine 安装需要提升权限而 Per-User 不需要?很简单,每个用户安装的注册表值写在 HKEY_CURRENT_USER 下,对于每个机器安装,注册表值写在 HKEY_LOCAL_MACHINE 下.只有管​​理员用户可以读/写 HKLM.

So why does Bootstrapper think that Per-Machine install needs elevated privileges and Per-User doesnt? Simple enough, per-user installation the registry value is written under HKEY_CURRENT_USER and for Per-machine installation the registry value is written under HKEY_LOCAL_MACHINE. Only Admin users can read/write to HKLM.

这篇关于WIX Burn Bootstrapper 不要求我的 MSI 的管理员权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 01:42