[wix-users] Condition to only Run Custom Actions on Initial Install

Bryan Dam bryand at recastsoftware.com
Mon Dec 20 08:49:23 PST 2021


Thanks Edwin, I love the idea of having a standard set of properties like that across all installers.

> using appropriate property names for my version of wix toolset. The post is pretty old.
Well, that maybe is the crux of my problem; what is outdated in that post? I don't see anything in Runtime.wxi at least that stands out as no longer relevant.  Though again, maybe that's my problem; I'm not seeing it.



From: Edwin Castro <egcastr at gmail.com>
Sent: Friday, December 17, 2021 4:50 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Bryan Dam <bryand at recastsoftware.com>
Subject: Re: [wix-users] Condition to only Run Custom Actions on Initial Install

I use the approach described here

https://code.dblock.org/2010/05/11/msi-property-patterns-upgrading-firstinstall-and-maintenance.html<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcode.dblock.org%2F2010%2F05%2F11%2Fmsi-property-patterns-upgrading-firstinstall-and-maintenance.html&data=04%7C01%7Cbryand%40recastsoftware.com%7C1c501c908a614f3ede6108d9c1a72557%7C9315bb44634846c6bd378880b87e774e%7C0%7C0%7C637753745908373494%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=l72zZ2AW4XTcYnFZD9N5VFfzHpf0v7IZvHPNHEQpAY8%3D&reserved=0>

using appropriate property names for my version of wix toolset. The post is pretty old.

Once you have these properties available you can just use FirstInstall in the condition which is easy to read and understand.

--
Edwin G. Castro


On Fri, Dec 17, 2021, 13:41 Bryan Dam via wix-users <wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>> wrote:
I'm kinda dumbfounded to even ask this since:
A) It's been asked and answered many times (here<https://stackoverflow.com/questions/17411913/how-can-i-perform-a-custom-action-in-wix-that-only-executes-on-install-or-uninst/17425109#17425109<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F17411913%2Fhow-can-i-perform-a-custom-action-in-wix-that-only-executes-on-install-or-uninst%2F17425109%2317425109&data=04%7C01%7Cbryand%40recastsoftware.com%7C1c501c908a614f3ede6108d9c1a72557%7C9315bb44634846c6bd378880b87e774e%7C0%7C0%7C637753745908383486%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=S3IFk4o%2F6dzCxXSGoLAIJtBD%2F2hilZ5WLFTnAnn6vC8%3D&reserved=0>>)
B) I've done my level-headed best to memorize this property value table (here<https://stackoverflow.com/questions/320921/how-to-add-a-wix-custom-action-that-happens-only-on-uninstall-via-msi/17608049#17608049<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstackoverflow.com%2Fquestions%2F320921%2Fhow-to-add-a-wix-custom-action-that-happens-only-on-uninstall-via-msi%2F17608049%2317608049&data=04%7C01%7Cbryand%40recastsoftware.com%7C1c501c908a614f3ede6108d9c1a72557%7C9315bb44634846c6bd378880b87e774e%7C0%7C0%7C637753745908383486%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=mmn6QviV7zzCefLlxjdP67ZSUylmNruGlb8k77SIPwI%3D&reserved=0>>)
C) I've done exactly this several times in other installers

And yet, here I am. I'm creating a new installer and verifying the major upgrade process before initial release.  There's some configuration steps that gets info from the user and then saves it to a configuration file via custom action.  We only want to run that action upon initial install and skip those actions upon upgrades (including RemoveExistingProducts) and full uninstall.  Otherwise the installer properties are empty (because that bit of the UI didn't run) and the config gets wiped.

In the past I have used both of these successfully:
(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE)
(NOT Installed) AND (NOT REMOVE)

I've tried every possible permutation of parenthesis there without success.  Each time the initial install works fine but upon upgrade it always runs them anyways.  I can post the full log if someone wants to see it but during the major upgrade it's skipping the actions upon install but running them during the uninstall triggered by RemoveExistingProducts.  I've tried changing the schedule from the default to afterInistallInitialize but that doesn't change the behavior.

Here's the segment as it sits now:
<Custom Action="ApplyAppConfigurationParameters" After="GenerateSelfSignedCertificate">(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE)</Custom>
<Custom Action="ApplyAppConfiguration" After="ApplyAppConfigurationParameters">(NOT Installed) AND (NOT UPGRADINGPRODUCTCODE)</Custom>

Anyone got any ideas? This makes no sense to me after 8 hours of plugging away at it.

  Thanks,
     Bryan

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/<https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.firegiant.com%2F&data=04%7C01%7Cbryand%40recastsoftware.com%7C1c501c908a614f3ede6108d9c1a72557%7C9315bb44634846c6bd378880b87e774e%7C0%7C0%7C637753745908393477%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=qKl%2BX42YsoHluMIvgFGzR87u0gCF51rjKKpe0Hs0hio%3D&reserved=0>



More information about the wix-users mailing list