Error 2762 when executing installer (WixCloseApplications) - worked with WiX 3.10.0.2103

2

I have a problem with my installer that uses WiX.

I updated to WiX 3.10.3.3007 some time before and if I try to build an installer with VS 2015. I now get strange errors during the installation. The build itself works and doesn't show any errors.

The old installer, that was build with WiX 3.10.0.2103, still works as expected. I used the same sourcecode both times.

The installation log says this:

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.

I don't have defined the WixCloseApplications or WixCloseApplicationsDeferred.

Part of my 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>

It doesn't work whether or not I have the line <util:CloseApplication Id="CloseApp" Target="myapp.exe" RebootPrompt="no" /> active.

I also tried to change the Ids and some other things... But had no luck. I tried to build the setup on different machines, but it didn't work also. And I tried it on a fresh Virtual Machine, where it worked...

Any idea why the installation fails on some machines and how I can fix this?

wix
wix3
asked on Stack Overflow Oct 11, 2016 by habakuk • edited Oct 14, 2016 by habakuk

1 Answer

0

The code with:

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

is generally the right way to do it, depending on the options you want to use. That's the issue that needs analyzing, but it appears that you went ahead and tried to create your own custom action to call, and that's where you get the 2762 error from, which is as the log and Brian describe. All you need do is declare the element and let WiX do the rest. If that correct use of the element doesn't work (and what does that mean exactly?) then that's what needs debugging.

That failing custom action is associated with CloseApp. Internally, the custom action will try to close down the target app, but also will schedule a deferred custom action to make sure that app goes away. Because you're not using it in the documented way you're getting undefined results.

Also note that the log has a line "MSI (s) (58:F0) [12:19:13:128]: Skipping RemoveExistingProducts action: current configuration is maintenance mode or an uninstall". In other words you are NOT doing a fresh install of your MSI. The MSI product (as defined by its ProductCode) is already on the system. When you try to install the same MSI twice it does not install it again - it goes into maintenance mode for the currently installed product, so none of the changes you make to your MSI are relevant because it's always doing maintenance repair on the one that is already installed, complete with its erroneous custom action. You must uninstall that before trying your modified MSI.

answered on Stack Overflow Oct 15, 2016 by PhilDW • edited Oct 17, 2016 by PhilDW

User contributions licensed under CC BY-SA 3.0