[wix-users] Passing value from bundle.wsx to bootstrapper code

Hoover, Jacob Jacob.Hoover at greenheck.com
Wed Jan 17 14:04:26 PST 2018

Bootstrapper.Engine.FormatString ?

And you need to include the []'s in your definition.

-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf Of Jon Earle via wix-users
Sent: Wednesday, January 17, 2018 3:55 PM
To: 'WiX Toolset Users Mailing List' <wix-users at lists.wixtoolset.org>
Cc: Jon Earle <earlej at hotmail.com>
Subject: [wix-users] Passing value from bundle.wsx to bootstrapper code

In my bundle.wxs:

<Variable Name="INSTALLDIR" bal:Overridable="yes" Value="C:\Program Files\Company\Client"/>

My cs code:

string userSpecifiedInstallDir = Bootstrapper.Engine.StringVariables["INSTALLDIR"];

No problem - I get the value, I can modify it, etc.

Now, If I try to be clever and use some of the builtin vars, such as in the following:

<Variable Name="INSTALLDIR" bal:Overridable="yes" Value="[ProgramFiles64Folder]"/>

I get the literal text "[ProgramFiles64Folder]" and not what it translates to.  How do I fix that?

Now, I actually want to get more clever and:

    <?if $(var.Platform) = x64 ?>
        <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
    <?else ?>
        <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
    <?endif ?>

So that I can be flexible.
I tried to use:

<Variable Name="INSTALLDIR" bal:Overridable="yes" Value="$(var.PlatformProgramFilesFolder )"/>

But that only gave me the literal text "ProgramFiles64Folder". I don't quite understand why, since, in my product.wxs, I have:

        <Directory Id='TARGETDIR' Name='SourceDir'>
            <Directory Id="$(var.PlatformProgramFilesFolder)">
                <Directory Id='MANUFACTURER' Name="Company">
                    <Directory Id='INSTALLDIR' Name="Client" />

And that works fine.  What am I missing?



WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

More information about the wix-users mailing list