我正在尝试将更新应用于已安装的应用程序(已在机器上多次安装)。据我所知,我在更新时将其传递给 .msi 实例的 ProductCode。
根据代码,这相当于:
// Leaving out my set of global parameters (for brevity), instance is first (:I1)
Installer.InstallProduct("FullNameOfMsiFile", @"MSIINSTANCEGUID={GUISDF-F5FD-4333-9D02-F0B72E048AB6} TRANSFORMS="":I1""");
当我尝试这个时,我得到一个 InstallerException 告诉我“系统策略禁止此安装。请联系您的系统管理员”。调用 .msi 的程序具有提升的权限,如果未传递产品代码,则可以正常安装/更新程序。
当我尝试在命令行上传递 ProductCode(使用/n 传递 Product Code)时,也会发生这种情况。 安装/更新在没有 ProductCode 的情况下也能很好地工作,所以我认为这是问题所在。
我已经尝试了互联网上提出的几种解决方案,例如关闭 UCA 或寻找某种注册表项并进行更改,但都没有成功。
那么,为什么 Windows(Win 7 32 位)明确禁止我传递产品代码,有没有简单的方法来解决这个问题?
无论如何,如果这仅在用户手动更改某些设置后才有效,那么我的好安装程序就有严重的问题,因为它意味着安装/更新没有任何大惊小怪。
编辑以回答塔菲特的问题:
更新是一次重大升级,通过WIX代码为每个实例生成一个新的ProductCode,因此每个实例都有自己的升级代码(对于实例来说是唯一的):
<Property Id="InstanceId" Value="Default"/>
<InstanceTransforms Property="InstanceId">
<Instance Id="I1" ProductCode="*" UpgradeCode="{GUID-2B92-407D-A609-C8DD9A0CF09C}" />
<Instance Id="I2" ProductCode="*" UpgradeCode="{GUID-85B4-4C68-B687-EBE02F282C2D}" />
<!-- further possible instances here, removed for brevity -->
</InstanceTransforms>
为每个实例存储产品代码,因此在尝试升级时我知道要为实例传递哪个产品代码。
编辑编号2:
EventLog 不是很有启发性,它只有三个属于不工作升级的事件(一个是 msi 启动,一个是创建恢复点,然后一个是安装程序事务停止,但没有说明原因)
.msi 的日志刚刚停止并显示错误代码 1625,这意味着系统策略拒绝安装。我真的不知道这些是什么政策以及如何处理它们。
MSI (c) (78:84) [08:51:46:479]: Machine policy value 'DisableUserInstalls' is 0
MSI (c) (78:84) [08:51:46:530]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (78:84) [08:51:46:570]: Grabbed execution mutex.
MSI (c) (78:84) [08:51:47:083]: Cloaking enabled.
MSI (c) (78:84) [08:51:47:120]: Attempting to enable all disabled privileges before calling Install on Server
MSI (c) (78:84) [08:51:47:170]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (B4:4C) [08:51:47:248]: Running installation inside multi-package transaction C:\Program Files\MyProgram\installer.msi
MSI (s) (B4:4C) [08:51:47:295]: Grabbed execution mutex.
MSI (s) (B4:A8) [08:51:47:340]: Resetting cached policy values
MSI (s) (B4:A8) [08:51:47:368]: Machine policy value 'Debug' is 0
MSI (s) (B4:A8) [08:51:47:403]: ******* RunEngine:
******* Product: C:\Program Files\MyProgram\installer.msi
******* Action:
******* CommandLine: **********
MSI (s) (B4:A8) [08:51:47:453]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (B4:A8) [08:51:47:498]: Machine policy value 'LimitSystemRestoreCheckpointing' is 0
MSI (s) (B4:A8) [08:51:47:561]: Note: 1: 1715 2: MyProgram
MSI (s) (B4:A8) [08:51:47:620]: Calling SRSetRestorePoint API. dwRestorePtType: 0, dwEventType: 102, llSequenceNumber: 0, szDescription: "MyProgram wird installiert".
MSI (s) (B4:A8) [08:52:07:257]: The call to SRSetRestorePoint API succeeded. Returned status: 0, llSequenceNumber: 14.
MSI (s) (B4:A8) [08:52:07:497]: MainEngineThread is returning 1625
MSI (s) (B4:4C) [08:52:07:587]: Calling SRSetRestorePoint API. dwRestorePtType: 13, dwEventType: 103, llSequenceNumber: 14, szDescription: "".
MSI (s) (B4:4C) [08:52:07:763]: The call to SRSetRestorePoint API succeeded. Returned status: 0.
MSI (s) (B4:4C) [08:52:07:863]: User policy value 'DisableRollback' is 0
MSI (s) (B4:4C) [08:52:07:944]: Machine policy value 'DisableRollback' is 0
MSI (s) (B4:4C) [08:52:08:045]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (B4:4C) [08:52:08:195]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (B4:4C) [08:52:08:262]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (B4:4C) [08:52:08:330]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\InProgress 3: 2
MSI (s) (B4:4C) [08:52:08:443]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\InProgress 3: 2
MSI (s) (B4:4C) [08:52:08:627]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (s) (B4:4C) [08:52:08:720]: Restoring environment variables
MSI (c) (78:84) [08:52:08:871]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (78:84) [08:52:08:936]: MainEngineThread is returning 1625
=== Verbose logging stopped: 28.05.2014 08:52:09 ===
最佳答案
尝试仔细阅读来自 Installshield 用户社区的旧线程:http://community.flexerasoftware.com/archive/index.php?t-169856.html或此讨论:Instance Transform incorrect on update
关于c# - 将产品代码传递给 MSI : This installation is forbidden by system policy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23866047/