@@ -145,7 +145,7 @@ void build() throws Exception {
145145 Element update = getOrCreateChild ( product , "MajorUpgrade" );
146146 addAttributeIfNotExists ( update , "AllowDowngrades" , "yes" );
147147
148- addMinimumVersionCheck ();
148+ addMinimumVersionCheck ( getGuid ( "UpgradeCode" ), 0 );
149149 }
150150
151151 // Directory
@@ -235,24 +235,26 @@ private void registerSchemeDefinition( ProtocolHandler handler ) {
235235
236236 /**
237237 * Add a minimum version for update check if set.
238+ * @param upgradeCode the GUID of the upgrade code
239+ * @param instance the instance number
238240 */
239- private void addMinimumVersionCheck () {
241+ private void addMinimumVersionCheck ( String upgradeCode , int instance ) {
240242 String version = setup .getMinimumUpdateVersion ();
241243 String message = setup .getMinimumUpdateMessage ();
242244 if ( version != null && message != null ) {
243245 // https://stackoverflow.com/questions/65787694/wix-prevent-only-certain-older-versions-from-being-updated
244246
245- Element upgrade = getOrCreateChildById ( product , "Upgrade" , getGuid ( "UpgradeCode" ) );
246- Element upgradeVersion = getOrCreateChildByKeyValue ( upgrade , "UpgradeVersion" , "Property" , "UNSUPPORTED_UPGRADE_VERSION_FOUND" );
247+ Element upgrade = getOrCreateChildById ( product , "Upgrade" , upgradeCode );
248+ Element upgradeVersion = getOrCreateChildByKeyValue ( upgrade , "UpgradeVersion" , "Property" , "UNSUPPORTED_UPGRADE_VERSION_FOUND_" + instance );
247249 addAttributeIfNotExists ( upgradeVersion , "OnlyDetect" , "yes" );
248250 addAttributeIfNotExists ( upgradeVersion , "Maximum" , version );
249251 addAttributeIfNotExists ( upgradeVersion , "IncludeMaximum" , "no" );
250252
251- Element customAction = getOrCreateChildByKeyValue ( product , "CustomAction" , "Id" , "UpgrateFromVersionNotSupported" );
253+ Element customAction = getOrCreateChildByKeyValue ( product , "CustomAction" , "Id" , "UpgrateFromVersionNotSupported_" + instance );
252254 addAttributeIfNotExists ( customAction , "Error" , message );
253255
254- Element action = addCustomActionToSequence ( "UpgrateFromVersionNotSupported" , false , "FindRelatedProducts" , true , null );
255- action .setTextContent ( "UNSUPPORTED_UPGRADE_VERSION_FOUND" );
256+ Element action = addCustomActionToSequence ( "UpgrateFromVersionNotSupported_" + instance , false , "FindRelatedProducts" , true , null );
257+ action .setTextContent ( "UNSUPPORTED_UPGRADE_VERSION_FOUND_" + instance );
256258 }
257259 }
258260
@@ -1427,6 +1429,8 @@ private void addMultiInstanceTransforms() throws IOException {
14271429 Element upgradeVersion = getOrCreateChildByKeyValue ( upgrade , "UpgradeVersion" , "Property" , "WIX_UPGRADE_DETECTED_" + i );
14281430 addAttributeIfNotExists ( upgradeVersion , "Minimum" , "0.0.0.0" );
14291431 addAttributeIfNotExists ( upgradeVersion , "MigrateFeatures" , "yes" );
1432+
1433+ addMinimumVersionCheck ( guid , i );
14301434 }
14311435 Element executeSequence = getOrCreateChild ( product , "InstallExecuteSequence" );
14321436 Element removeExistingProducts = getOrCreateChild ( executeSequence , "RemoveExistingProducts" );
0 commit comments