How to set and check Bundle variables?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set and check Bundle variables?

patrickpirzer
This post has NOT been accepted by the mailing list yet.
Hello,

I have made a Bootstrapper application with WiX 3.8, in which the user can select between three different setuptypes (Single PC, Client and Server).
In the bundle i defined three variables:

        <?define IsWorkstationSetup = "true" ?>
        <?define IsClientSetup = "false" ?>
        <?define IsServerSetup = "false" ?>

The first mask in the UI offers the user three radio buttons, from which he can select one.
If the user per example selects the radio button for Server, then the variable IsServerSetup will be set to "true" and when i read the value from the variable, the value is "true" (p.e. at the beginning of the bootstrapper-method Plan).
This looks like that:

    Bootstrapper.Engine.StringVariables["IsServerSetup"] = "true";

In the chain of the bootstrapper bundle, i try to check the variables:

            <?if $(var.IsServerSetup) = "true"?>
                <PackageGroupRef Id='SetupForServer'/>
            <?endif?>

But each time, i'm making a test installation, the package for the single PC is installed while the variable IsWorkstationSetup is "false".
It seems to be, that the bundle uses not the new setted value but the default value from the definition.

What can i do, to prevent that mistake?
Thanks in advance!
Reply | Threaded
Open this post in threaded view
|

Re: How to set and check Bundle variables?

Phill Hogland
Preprocessor statements <?...?> are resolved at compile time, so you probably don't want to use them because the 'user' cannot make any selection when your project is being compiled.  Use the Variable element and define bal:overridable='yes'

    <Variable Name='IsServerSetup' Type='string' Value='true' bal:Overridable='yes'/>

Forget trying to use preprocessor in the chain.  The best approach is to implement your package selection logic in custom BA, in the planning handlers.  You could also use the variable in the  MsiPackage/@InstallCondition='IsServerSetup="true"'
Reply | Threaded
Open this post in threaded view
|

Re: How to set and check Bundle variables?

Phill Hogland
I'm sorry for responding to this in the devs forum.  This question should have been posted to wix-users.
Reply | Threaded
Open this post in threaded view
|

AW: How to set and check Bundle variables?

patrickpirzer
In reply to this post by Phill Hogland

Thank You, Phill!

 

That’s exactly what i have done an hour ago.

Further i have some prerequisites like SQL Server Express, which shall be installed on single PC and server.

I think i have to adjust the InstallConditions the same way.

 

Thank You for Your hint and have a nice day!

 

Greetings,

Patrick

 

Von: Phill Hogland [via Windows Installer XML (WiX) toolset] [mailto:ml-node+[hidden email]]
Gesendet: Dienstag, 25. November 2014 16:48
An: Patrick Pirzer
Betreff: Re: How to set and check Bundle variables?

 

Preprocessor statements <?...?> are resolved at compile time, so you probably don't want to use them because the 'user' cannot make any selection when your project is being compiled.  Use the Variable element and define bal:overridable='yes'

    <Variable Name='IsServerSetup' Type='string' Value='true' bal:Overridable='yes'/>

Forget trying to use preprocessor in the chain.  The best approach is to implement your package selection logic in custom BA, in the planning handlers.  You could also use the variable in the  MsiPackage/@InstallCondition='IsServerSetup="true"'


If you reply to this email, your message will be added to the discussion below:

http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/How-to-set-and-check-Bundle-variables-tp7598223p7598228.html

To unsubscribe from How to set and check Bundle variables?, click here.
NAML