PDA

View Full Version : Conditionally installing Components based on Release Flags



mlerch
08-02-2013, 11:57 AM
Under Help for Configuring Component Conditions it states:

> Conditional installation of your components can be useful if you are creating different versions of the same product—for example, a trial version and a full version. You might not want to provide full functionality in the trial version, therefore you would not install all of the components.

That's exactly what I need to do. I build a Full product msi and a Trial msi. I currently use two different project files. They each contain 3 features: "Common," "32 bit Files" and "64 bit Files." Some of the Components under "32 bit Files" and "64 bit Files" should not be installed for the Trial version. How exactly can I accomplish that?

Currently, the "32 bit Files" Feature has a Release Flags of "x86" and the "64 bit Files" Feature has a Release Flags of "x64." Those Release Flags are referenced in the Project Configuration Flags of my Release Configurations, which match my 32bit builds and my 64bit builds. Rather than adding new Features which are essentially "Exclusion" Features which I would exclude for the Trial release, I'd like to simply mark some of the Components under my current "32 bit Files" and "64 bit Files" as "NOT Trial" and add "Trial" as a Release Flag in my Trial Release Configuration. Can this be accomplished? According to the documentation sentences as mentioned above, that's precisely how the Condition property at the Component level can be used. I'm just not sure of the syntax.

Thanks!

phill_mn
08-02-2013, 01:10 PM
I implemented Release Flags a long time ago and had to go back and look at it to evaluate your question. I have one project file, which includes all of the possible features and components for all variations. Those features that are common to all releases do not have any Release Flag set in the Features view. Features related to ConfigurationA have ReleaseFlagA. Features related to ConfigurationB have ReleaseFlagB.

Now in Release view I have four variant builds:
ConfigA_x86 has ReleaseFlagB set (see Release view), which includes the CommonFeatures and the ConfigAFeatures, with x86 TemplateSummary.
ConfigA_x64 has ReleaseFlagB set, which includes the CommonFeatures and the ConfigAFeatures, with x64 TemplateSummary.
ConfigB_x86 has ReleaseFlagA set, which includes the CommonFeatures and the ConfigBFeatures, with x86 TemplateSummary.
ConfigB_x64 has ReleaseFlagA set, which includes the CommonFeatures and the ConfigBFeatures, with x64 TemplateSummary.

The ReleaseFlag related components are excluded from the build. Since you can specify more than one release flag in any specific build, combined with the conditional and platform testing at the component level, there are a lot of ways to approach these issues.

mlerch
08-02-2013, 02:11 PM
> Since you can specify more than one release flag in any specific build, combined with the conditional and platform testing at the component level, there are a lot of ways to approach these issues.

Right. I'm already doing it Feature based (same as you), it would be a lot more efficient if I could employ use of the Condition property at the Component level, which is specifically what I'm trying to find out how to do.

rguggisberg
08-02-2013, 02:37 PM
Arrange your Components into Features and then go to the 'Setup Design' view and use the Release Flags and or Condition there.

mlerch
08-02-2013, 04:57 PM
For anyone stumbling here in the future, what I did was use the -z flag of the command-line builder to set a custom MSI property. Each of my builds is controlled by a line in a batch file, and each line now has a new -z "RELEASETYPE=FREEWARE" (or "TRIAL" etc.), e.g.

"C:\Program Files (x86)\InstallShield\2013\System\IsCmdBld.exe" -c COMP -p "C:\work\...MyProject.ism" -r ReleaseName -y 1.0.0.1 -z "RELEASETYPE=READONLY"

My Component Condition then checks that custom property to know if it should be excluded by a specific build, e.g.

RELEASETYPE<>"READONLY"

This allows me to keep my current Function structure and not get excessive with duplicating Components across Features, whose size is not insignificant.

Works like a charm.

Mark

MichaelU
08-05-2013, 08:08 AM
As a heads-up, make sure you're aware of one critical difference between these two approaches. Release flags at the feature level will cause the features (and components that are only associated with such features, and thus those component's files) to be excluded from the build. Setting a condition on a component will only prevent it from being installed by default.

There's nothing inherently wrong with either approach, but don't depend on the latter for your licensing. Consider what someone who can examine the .msi can do by setting a property RELEASETYPE=<string that includes everything> on the msiexec command line. If you do use release-flagged features, don't forget that you can hide features. This lets you specify release flags at a smaller granularity than the selections you expose to your end users.

mlerch
08-05-2013, 08:25 AM
Ah..now that is excellent information I never considered. Thank you, I'll have to reconsider.