wix - 执行安装程序 (WixCloseApplications) 时出现错误 2762 - 使用 WiX 3.10.0.2103

标签 wix wix3

我的安装程序使用 WiX 时遇到问题。

我之前更新到 WiX 3.10.3.3007,如果我尝试使用 VS 2015 构建安装程序。我现在在安装过程中遇到奇怪的错误。构建本身可以工作并且不会显示任何错误。

使用 WiX 3.10.0.2103 构建的旧安装程序仍然按预期工作。我两次都使用了相同的源代码。

安装日志是这样写的:

Action ended 12:19:13: InstallValidate. Return value 1.
MSI (s) (58:F0) [12:19:13:127]: Doing action: RemoveExistingProducts
MSI (s) (58:F0) [12:19:13:127]: Note: 1: 2205 2:  3: ActionText 
Action start 12:19:13: RemoveExistingProducts.
MSI (s) (58:F0) [12:19:13:128]: Skipping RemoveExistingProducts action: current configuration is maintenance mode or an uninstall
Action ended 12:19:13: RemoveExistingProducts. Return value 0.
MSI (s) (58:F0) [12:19:13:129]: Doing action: WixCloseApplications
MSI (s) (58:F0) [12:19:13:129]: Note: 1: 2205 2:  3: ActionText 
Action start 12:19:13: WixCloseApplications.
MSI (s) (58:EC) [12:19:13:131]: Invoking remote custom action. DLL: C:\Windows\Installer\MSI9A67.tmp, Entrypoint: WixCloseApplications
MSI (s) (58!B0) [12:19:13:137]: PROPERTY CHANGE: Adding WixCloseApplicationsDeferred property. Its value is 'DisplayQ-Daily.exe3350002'.
MSI (s) (58!B0) [12:19:13:138]: Doing action: WixCloseApplicationsDeferred
MSI (s) (58!B0) [12:19:13:138]: Note: 1: 2205 2:  3: ActionText 
Action start 12:19:13: WixCloseApplicationsDeferred.
MSI (s) (58!B0) [12:19:13:139]: Note: 1: 2762 
MSI (s) (58!B0) [12:19:13:139]: Note: 1: 2205 2:  3: Error 
MSI (s) (58!B0) [12:19:13:139]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 2762 
DEBUG: Error 2762:  Unable to schedule operation. The action must be scheduled between InstallInitialize and InstallFinalize.
MSI (c) (60:68) [12:19:13:146]: Font created.  Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2762. The arguments are: , , 
MSI (s) (58!B0) [12:19:15:071]: Note: 1: 2205 2:  3: Error 
MSI (s) (58!B0) [12:19:15:071]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709 
MSI (s) (58!B0) [12:19:15:071]: Product: DisplayQDaily -- The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2762. The arguments are: , , 

Action ended 12:19:15: WixCloseApplicationsDeferred. Return value 3.
WixCloseApplications:  Error 0x80070643: Failed MsiDoAction on deferred action
WixCloseApplications:  Error 0x80070643: failed to schedule WixCloseApplicationsDeferred action
CustomAction WixCloseApplications returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 12:19:15: WixCloseApplications. Return value 3.

我没有定义 WixCloseApplicationsWixCloseApplicationsDeferred .

我的一部分 Product.wxs :
<Product Id="*" Name="DDQD" Language="1033" Version="!(bind.fileVersion.Exe)" Manufacturer="HipHipHura" UpgradeCode="931619FF-BB02-475F-8853-D0623F3FF0CB">

    <Package InstallerVersion="405" Compressed="yes" InstallScope="perMachine" />

    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
    <MediaTemplate />

    <Feature Id="ProductFeature" Title="Installer" Level="1">
      <ComponentGroupRef Id="ProductComponents" />
      <ComponentGroupRef Id="AutoGeneratedComponents"/>
      <ComponentRef Id="UninstallShortcutComponent"/>
      <ComponentRef Id="CreateAppDataFolder" />
      <ComponentRef Id="Permission.AppDataFolder" />
    </Feature>

    <PropertyRef Id="WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED"/>
    <Condition Message=".NetFramework nicht installiert">
      <![CDATA[Installed OR WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED]]>
    </Condition>

    <Feature Id="VCRedist" Title="Visual C++ 13.0 Runtime" AllowAdvertise="no" Display="hidden" Level="1">
      <MergeRef Id="VCRedist"/>
    </Feature>

    <Component Id="CreateAppDataFolder" Directory="AppDataFolder" Guid="{78EDDF6C-110E-4020-97B8-5E55E3FFFA48}" KeyPath="yes">
      <CreateFolder />
    </Component>

    <Binary Id="CustomAction.CA.dll" SourceFile="..\CustomAction\bin\$(var.Configuration)\CustomAction.CA.dll" />
    <CustomAction Id="CloseApp" Return="check" Execute="immediate" BinaryKey="CustomAction.CA.dll" DllEntry="CloseApplicationAction" />

    <CustomAction Id="LaunchApp" Directory="INSTALLFOLDER" ExeCommand="[SystemFolder]cmd.exe /C start myapp.exe --fromInstaller" Return="asyncNoWait" />

    <InstallExecuteSequence>
      <Custom Action="CloseApp" Before="LaunchConditions"/>
      <Custom Action="LaunchApp" OnExit="success">NOT Installed</Custom>
    </InstallExecuteSequence>

    <!--<util:CloseApplication Id="CloseApp" Target="myapp.exe"  RebootPrompt="no"   />/-->

  </Product>

无论我是否有线路 <util:CloseApplication Id="CloseApp" Target="myapp.exe" RebootPrompt="no" /> 都不起作用积极的。

我还尝试更改 Id 和其他一些东西......但没有运气。我尝试在不同的机器上build设置,但它也不起作用。我在一个新的虚拟机上尝试了它,它在那里工作......

知道为什么在某些机器上安装失败以及如何解决这个问题吗?

最佳答案

代码与:

util:CloseApplication Id="CloseApp"Target="myapp.exe"RebootPrompt ="no"

通常是正确的方法,具体取决于您要使用的选项。这是需要分析的问题,但似乎您继续尝试创建自己的自定义操作来调用,这就是您从日志和布莱恩所描述的 2762 错误中得到的地方。您需要做的就是声明元素,让 WiX 做剩下的事情。如果元素的正确使用不起作用(这到底是什么意思?)那么这就是需要调试的地方。

该失败的自定义操作与 CloseApp 相关联。在内部,自定义操作将尝试关闭目标应用程序,但也会安排延迟自定义操作以确保该应用程序消失。因为您没有以记录的方式使用它,所以您得到了未定义的结果。

另请注意,日志中有一行“MSI (s) (58:F0) [12:19:13:128]:Skipping RemoveExistingProducts 操作:当前配置是维护模式或卸载”。换句话说,您不是在全新安装 MSI。 MSI 产品(由其产品代码定义)已在系统上。当您尝试安装相同的 MSI 两次时,它不会再次安装它 - 它会进入当前安装产品的维护模式,因此您对 MSI 所做的任何更改都无关紧要,因为它总是对正在安装的产品进行维护修复已经安装,完成其错误的自定义操作。在尝试修改后的 MSI 之前,您必须卸载它。

关于wix - 执行安装程序 (WixCloseApplications) 时出现错误 2762 - 使用 WiX 3.10.0.2103,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39977510/

相关文章:

wix - 如何更改 Wix 安装程序对话框中的文本?

WiX 未定义的预处理器变量

c# - WiX 自定义操作未执行

com - 将dll安装到tlb文件以外的其他文件夹中时,COM注册失败:“自动化错误:系统找不到指定的文件”

wix - 如何系统地为使用热量收集的文件设置 "ReadOnly"属性?

windows - WiX 安装程序 : How to switch to repair-mode if already installed?

installation - 运行 RemovePreviousVersion 时,MSI 不会安装所有文件

wix - 如何在 WiX 中的 ="InstallValidate"之后执行删除现有产品之前的自定义操作

c# - Wix 中的大多数事情都必须手动完成吗?

c# - WIX 3.0 从 .NET 项目生成功能