1

The error is thrown while supporting the 47th instance. It runs fine if I remove the action SetMyInstance_Instance47. I need to support 100 instances. The code snippet is as below.

<InstallExecuteSequence>
 <Custom Action="SetMyInstance_Instance46" After="SetMyInstance_Instance45"><![CDATA[ACTION = "INSTALL" AND MYINSTANCE = "DontUseThis" AND  (INSTANCE46INSTALLEDPRODUCTCODE = "" AND INSTANCE46INSTALLEDPRODUCTCODE64 = ""  AND INSTANCE46INSTALLEDPRODUCTCODE32 = "")  AND SECONDEXECUTE <> 1 ]]></Custom>
      <Custom Action="SetMyInstance_Instance47" After="SetMyInstance_Instance46"><![CDATA[ACTION = "INSTALL" AND MYINSTANCE = "DontUseThis" AND  (INSTANCE47INSTALLEDPRODUCTCODE = "" AND INSTANCE47INSTALLEDPRODUCTCODE64 = ""  AND INSTANCE47INSTALLEDPRODUCTCODE32 = "")  AND SECONDEXECUTE <> 1 ]]></Custom>
 </InstallExecuteSequence>

Wix Error: The InstallExecuteSequence table contains an action 'SetMsiNewInstance' which cannot have a unique sequence number because it is scheduled before or after action 'AppSearch'. There is not enough room before or after this action to assign a unique sequence number. Please schedule one of the actions differently so that it will be in a position with more sequence numbers available. Please note that sequence numbers must be an integer in the range 1 - 32767 (inclusive).

  • That sounds somewhat crazy with all those instances, I have to admit, but [here is an answer you might want to skim](https://stackoverflow.com/a/52106844/129130). It looks like you are running out of sequence numbers in order in the InstallExecuteSequence, but I am not sure. Please read that link and see if it makes sense first of all. – Stein Åsmul May 27 '20 at 20:42
  • Please see the answer I added. Just a hack, but might get your source to compile. Wondering what you are doing in those custom actions though. – Stein Åsmul May 28 '20 at 23:45

2 Answers2

0

MSI doesn't have to have unique sequence numbers. Multiple actions can have the same sequence number it just isn't promised which will run first. If all of these instances are mutually exclusive it wouldn't matter.

The other option would be to have 1 custom action that reads from a custom table and does the same processing but only taking up one sequence position.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • [Chris, seen this one](https://stackoverflow.com/questions/52089710/appsearch-has-sequence-number-50-right/52106844#52106844)? Sounds scary with all those instances btw. – Stein Åsmul May 27 '20 at 20:51
  • @Christopher, Can you please let me know why this error occurring only at 47th instance? **The InstallExecuteSequence table contains an action 'SetMsiNewInstance' which cannot have a unique sequence number because it is scheduled before or after action 'AppSearch'. There is not enough room before or after this action to assign a unique sequence number. Please schedule one of the actions differently so that it will be in a position with more sequence numbers available. Please note that sequence numbers must be an integer in the range 1 - 32767 ** – Suja Eeshan May 28 '20 at 16:34
  • I have no idea. It's not documented by Microsoft and they might not even know it's a limitation anyways. If sequence numbers had to be unique they would have made the column a key column. https://learn.microsoft.com/en-us/windows/win32/msi/installexecutesequence-table – Christopher Painter May 28 '20 at 17:59
  • @SujaEeshan I have added another answer, but I am not sure if what you do is sound design. What are you actually doing in these custom actions? – Stein Åsmul May 28 '20 at 23:44
0

For diagnosis - first of all (before any fix), please try this:

  • Open your MSI in Orca or equivalent editor
  • Go to the InstallExecuteSequence, sort by Sequence (right column).
  • What numbers do you see? Notice the gaps in the numbers. Those gaps are to allow other actions "in between" the standard actions. If you run out of "gaps" then you will probably get the message you receive.
  • There are "default numbers" used for the standard actions and they seem to be defined in a file called actions.xml (please do visit that link).

=> Conclusion? You need bigger gaps between the standard actions. At least that is ONE of the things you need. What you really need to do is to stop using so many instances :-).

You can try to manually set the sequence number AND you can assign new numbers to the standard actions:

<InstallExecuteSequence>

   <..>

     <!-- Redefine standard action numbers -->

      <LaunchConditions Sequence='300'></LaunchConditions>
      <FindRelatedProducts Sequence='2'></FindRelatedProducts>

   <..>

     <!-- Manually assign custom action sequence numbers -->

       <Custom Sequence="44" Action='SomethingDoneHere1' />
       <Custom Sequence="45" Action='SomethingDoneHere2' />

   <..>

</InstallExecuteSequence>

Orca

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • That reminds me... 2005/2006 I was working at a place that had thousands of installutil custom actions brought in via VDPROJ merge modules. VDPROJ only allowed you to sequence like Install, Uninstall, Rollback and Commit. All Install custom actions were scheduled the same way (after InstallFiles I think). So the built MSI would have hundreds of custom actions with the same sequence numbers. I had to write build automation to rewrite the sequence using a whitelist and bubble sort. None of this was my choice and I eventually quit. I came back a couple years later... – Christopher Painter May 29 '20 at 02:55
  • IsWiX was born, all of the installers were rewritten and I rejoiced when the very last InstallUtil custom action was eliminated. – Christopher Painter May 29 '20 at 02:55
  • @Stein Asmul, I was not aware of Orca editor, Thanks for guiding me on the right track. – Suja Eeshan Jun 02 '20 at 06:50
  • How did you solve it? I think you can use the approach above to set manual sequence numbers, but that is a lot of details to work out. Perhaps you used Orca to post-process the MSI? I got the impression that the WiX source did not compile at all. – Stein Åsmul Jun 02 '20 at 07:12