Determine first time installation after advertisin
Posted 15 June 2009 - 09:31
I have some components containing some sample files that will be deleted by the user. They should be installed if the feature they belong to (the program) is installed the first time, but not if the installation is running as an upgrade. The component condition
'Not Installed And Not ANYVERSIONFOUND'
is OK for this in most cases (ANYVERSIONFOUND is set by the FindRelatedProducts action if an older version is installed).
But when the installation is advertised, the sample file components are not installed, as they only have files. When the program files are installed after the product icon is clicked (advertised shortcut), the sample components are not installed as 'Not Installed' is false now.
Is there any way to solve this?
Posted 15 June 2009 - 10:34
BTW. The easy way is to use a NULL-GUID as ComponentId. Remove the condition and remove the ComponentId of these components. At the first install, the component ist installed correctly. WEhen using a NULL-Guid, the component wasn't registred by MSI, so repair, upgrade and remove operations shouldn't work.
Inside Windows Installer 4.5
Posted 15 June 2009 - 14:08
To solve the advertisement issue I'll try this:
If the feature is installed ((&FeatureName=3) AND NOT(!FeatureName=3)) and the product has not been installed yet (Property set by AppSearch), after CostFinalize I run a CA that enables the right component using MsiSetComponentState.
So the components should not be installed if the CA is not run. Is there an easy way to do this?
Posted 15 June 2009 - 20:06
Where (after Costfinalize) do I have to schedule the MsiSetComponentState CA so that it takes any effect?
Posted 16 June 2009 - 14:48
For those who are interested in a solution:
I associated the components to a new invisble top level feature which is set to install level 32767, so it won't be installed by default. Then I scheduled a CA in the install exec sequence after CostFinalize which is executed when my product's main feature is installed (Condition: (&FeatureName=3) AND NOT(!FeatureName=3) AND NOT PRODUCTWASINSTALLED, see one of my previous posts). The components have the NULL GUID, so I don't have to bother with maintenance or condition reevaluation (Thanks again to Andreas!)
This works at least for my needs. Keep in mind that doing so will cause the file cost to be calculated incorrectly!
Edited by boz, 16 June 2009 - 14:52.
Posted 17 June 2009 - 10:09
Inside Windows Installer 4.5
Posted 17 June 2009 - 14:44
It sets the invisble feature to Local by calling MsiSetFeatureState. This sets all sample components' request state to Local and the component conditions select the one that is really installed
Thanks again, Andreas. I never heard of that table. Although it won't help me to calculate the correct size, I can reserve a minimum size, so that there will always be enough space to install the sample files.