为什么安装程序在删除提升的特权要求后失败?

Why does installer fail after removing elevated privilege requirement?

我按照此答案中关于为非提升用户制作 setup.msi 的说明进行了操作:

我已经成功地将这些说明用于不同的应用程序。

当我 运行 按原样安装 .msi 时,它需要管理员权限才能安装,否则安装没有问题。

这里是.bat文件 我运行去掉管理员权限提示

"C:\Program Files (x86)\Windows Kits\bin.0.18362.0\x86\MsiInfo.exe" "C:\Users\jbrown\source\repos\Step File Generator\Step File Tool\Release\Step File Tool.msi" -w 10
pause

在我 运行 这个 bat 并尝试安装 msi 之后,它继续通过通常要求管理员权限的部分,但是为什么我会收到以下错误?

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2920.

我研究了这个错误代码,但没有得到有用的结果。 以下建议我获取 msi 日志: https://www.itninja.com/question/the-error-code-is-2920

当我尝试使用以下命令通过 powershell 运行 msi 时:

msiexec /l*v "H:\log.log" /i '.\Step File Tool.msi'

我收到以下错误:

This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.

下面是日志输出:

=== Verbose logging started: 12/11/2020  11:31:47  Build type: SHIP UNICODE 5.00.10011.00  Calling process: C:\WINDOWS\system32\msiexec.exe ===
MSI (c) (84:A0) [11:31:47:820]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

MSI (c) (84:A0) [11:31:47:820]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

MSI (c) (84:A0) [11:31:47:839]: Resetting cached policy values
MSI (c) (84:A0) [11:31:47:839]: Machine policy value 'Debug' is 0
MSI (c) (84:A0) [11:31:47:839]: ******* RunEngine:
           ******* Product: .\Step File Tool.msi
           ******* Action: 
           ******* CommandLine: **********
MSI (c) (84:A0) [11:31:47:841]: Machine policy value 'DisableUserInstalls' is 0
MSI (c) (84:A0) [11:31:47:884]: Note: 1: 1324 2: . 3: 1 
MSI (c) (84:A0) [11:31:47:884]: MainEngineThread is returning 2
=== Verbose logging stopped: 12/11/2020  11:31:47 ===

有限的每用户设置:每用户设置必须遵守一些限制:https://www.advancedinstaller.com/user-guide/single-package.html

I don't like per-user MSI installers 而且我发现很难交付适用于每台机器和每用户部署方案的设置。它与密谋在你身上的上述限制有关。我会 select 一个或另一个(仅限每台机器或每个用户 - 这里的每台机器设置更复杂,可以隐藏其他用户的快捷方式)。

示例:以下是一些使用 WiX 的每个用户示例:

进行有限权限设置的核心是遵守上面 link 中列出的限制,并且 - 如果您使用的是 WiX - 在 MSI 中设置 Package element appropriately (for other tools you need to set these parameters in the appropriate GUI - Summary Information Stream 设置) :

<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" InstallPrivileges="limited" />

MSI Tools: Visual Studio 安装程序项目有很多限制。 .

  • List of MSI tools
  • WiX quick start links