Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Determine first time installation after advertisin


6 replies to this topic

boz

boz
  • Full Members
  • 12 posts

Posted 15 June 2009 - 09:31

How can I determine if an installation runs the first time when the product has been advertised?

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?


akerl

akerl
  • Full Members
  • 104 posts

Posted 15 June 2009 - 10:34

Is the component marked as transitive?

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.

Andreas Kerl

Inside Windows Installer 4.5
ISBN 3-86645-431-7


boz

boz
  • Full Members
  • 12 posts

Posted 15 June 2009 - 14:08

I've never heard about the NULL GUID (although it is documented) but it seems this is what I'm looking for.

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?

boz

boz
  • Full Members
  • 12 posts

Posted 15 June 2009 - 20:06

It does not work. The call to MsiSetComponentState is executed, but this does not change the component state of any of the components.

Where (after Costfinalize) do I have to schedule the MsiSetComponentState CA so that it takes any effect?

boz

boz
  • Full Members
  • 12 posts

Posted 16 June 2009 - 14:48

It seems to me that by calling MsiSetComponentState you cannot modify the component's action state but the request state. So a negative component condition will set the action state to NULL regardless of the MsiSetComponentState call.

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.


akerl

akerl
  • Full Members
  • 104 posts

Posted 17 June 2009 - 10:09

Nice. To solve the file cost issue, you can use the table ReserveCost.

Andreas Kerl

Inside Windows Installer 4.5
ISBN 3-86645-431-7


boz

boz
  • Full Members
  • 12 posts

Posted 17 June 2009 - 14:44

In my last post I forgot to mention the most important part - what the CA does wacko.gif

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.