title: Error 2762 when executing installer (WixCloseApplications) - worked with WiX 3.10.0.2103
body: <p>I have a problem with my installer that uses WiX.</p>
  
  <p>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. </p>
  
  <p>The old installer, that was build with WiX 3.10.0.2103, still works as expected. I used the same sourcecode both times.</p>
  
  <p>The installation log says this:</p>
  
  <pre><code>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.
  </code></pre>
  
  <p>I don't have defined the <code>WixCloseApplications</code> or <code>WixCloseApplicationsDeferred</code>.</p>
  
  <p>Part of my <code>Product.wxs</code>:</p>
  
  <pre><code>&lt;Product Id="*" Name="DDQD" Language="1033" Version="!(bind.fileVersion.Exe)" Manufacturer="HipHipHura" UpgradeCode="931619FF-BB02-475F-8853-D0623F3FF0CB"&gt;
  
      &lt;Package InstallerVersion="405" Compressed="yes" InstallScope="perMachine" /&gt;
  
      &lt;MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /&gt;
      &lt;MediaTemplate /&gt;
  
      &lt;Feature Id="ProductFeature" Title="Installer" Level="1"&gt;
        &lt;ComponentGroupRef Id="ProductComponents" /&gt;
        &lt;ComponentGroupRef Id="AutoGeneratedComponents"/&gt;
        &lt;ComponentRef Id="UninstallShortcutComponent"/&gt;
        &lt;ComponentRef Id="CreateAppDataFolder" /&gt;
        &lt;ComponentRef Id="Permission.AppDataFolder" /&gt;
      &lt;/Feature&gt;
  
      &lt;PropertyRef Id="WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED"/&gt;
      &lt;Condition Message=".NetFramework nicht installiert"&gt;
        &lt;![CDATA[Installed OR WIX_IS_NETFRAMEWORK_452_OR_LATER_INSTALLED]]&gt;
      &lt;/Condition&gt;
  
      &lt;Feature Id="VCRedist" Title="Visual C++ 13.0 Runtime" AllowAdvertise="no" Display="hidden" Level="1"&gt;
        &lt;MergeRef Id="VCRedist"/&gt;
      &lt;/Feature&gt;
  
      &lt;Component Id="CreateAppDataFolder" Directory="AppDataFolder" Guid="{78EDDF6C-110E-4020-97B8-5E55E3FFFA48}" KeyPath="yes"&gt;
        &lt;CreateFolder /&gt;
      &lt;/Component&gt;
  
      &lt;Binary Id="CustomAction.CA.dll" SourceFile="..\CustomAction\bin\$(var.Configuration)\CustomAction.CA.dll" /&gt;
      &lt;CustomAction Id="CloseApp" Return="check" Execute="immediate" BinaryKey="CustomAction.CA.dll" DllEntry="CloseApplicationAction" /&gt;
  
      &lt;CustomAction Id="LaunchApp" Directory="INSTALLFOLDER" ExeCommand="[SystemFolder]cmd.exe /C start myapp.exe --fromInstaller" Return="asyncNoWait" /&gt;
  
      &lt;InstallExecuteSequence&gt;
        &lt;Custom Action="CloseApp" Before="LaunchConditions"/&gt;
        &lt;Custom Action="LaunchApp" OnExit="success"&gt;NOT Installed&lt;/Custom&gt;
      &lt;/InstallExecuteSequence&gt;
  
      &lt;!--&lt;util:CloseApplication Id="CloseApp" Target="myapp.exe"  RebootPrompt="no"   /&gt;/--&gt;
  
    &lt;/Product&gt;
  </code></pre>
  
  <p>It doesn't work whether or not I have the line <code>&lt;util:CloseApplication Id="CloseApp" Target="myapp.exe"  RebootPrompt="no"   /&gt;</code> active.</p>
  
  <p>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...</p>
  
  <p>Any idea why the installation fails on some machines and how I can fix this?</p>