将产品代码传递给MSI:系统策略禁止此安装

时间:2014-05-26 08:37:48

标签: c# wix windows-installer

我正在尝试对已安装的应用程序(在计算机上多次安装)应用更新。我知道实例的ProductCode,我将它传递给更新时的.msi。

从代码中,这相当于:

// 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传递产品代码)时,也会发生这种情况。 没有ProductCode,安装/更新很好地工作,所以我认为这是问题所在。

我已尝试过几种来自互联网的解决方案,比如转向UCA或寻找某种注册表项并更改它,但没有成功。

那么,为什么Windows(Win 7 32位)明确禁止我传递产品代码并且有一种简单的方法来解决这个问题?

在任何情况下,如果这只能在用户手动更改某些设置后才能生效,那么我的好安装程序会出现严重问题,因为它意味着安装/更新而不用担心。

编辑以回答来自taffit的问题:

更新是一项重大升级,每个实例都会通过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>

为每个实例存储产品代码,因此在尝试升级时,我知道要为实例传递哪个产品代码。

编辑Nr。 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 ===

1 个答案:

答案 0 :(得分:0)

尝试仔细阅读Installshield用户社区中的旧线程:http://community.flexerasoftware.com/archive/index.php?t-169856.html或此讨论:Instance Transform incorrect on update