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

Set Component Condition through Property


1 reply to this topic

shahedC

shahedC
  • Members
  • 8 posts

Posted 11 November 2004 - 23:57

I have an InstallScript MSI Project in which certain components are installed based on the value of a Property defined in the Property Manager.

ComponentA needs to be installed when MyProperty = "A", so the Condition for this component is set to:
MyProperty = "A"

ComponentB needs to be installed when MyProperty = "B", so the Condition for this component is set to:
MyProperty = "B"

The value of the property is not provided on the Property Manager screen. It is set during the setup process by MsiSetProperty(). The following code is used:

MsiSetProperty (ISMSI_HANDLE, "MyProperty", sText);

where sText = "A" or "B".

Within the InstallScript code, I tried using MsiGetProperty() to make sure that I am getting and setting the correct property. I used the following code:

nvSize = 256;
MsiGetProperty (ISMSI_HANDLE, "MyProperty", sText, nvSize);
MessageBox("The value is " + sText, INFORMATION);

If I call this before I set the property, the value shown is the same initial value set in the Property Manager screen. If I call it after I set the property, the value shown is the new value that I just set it to. This tells me that I am indeed getting and setting the correct property.

But my installation seems to ignore the changed value of the property. After installation is performed, it seems that ComponentA is only installed when MyProperty is set to "A" in the Property Manager. Likewise, ComponentB is only installed when MyProperty is set to "B" in the Property Manager.

It seems as if the installation is completely ignoring the value that is set in the InstallScript. What am I doing wrong?



shahedC

shahedC
  • Members
  • 8 posts

Posted 12 November 2004 - 00:10

I figured it out. Simply define the property name in all caps, e.g. MYPROPERTY instead of MyProperty