[wix-users] Passing value from bundle.wsx to bootstrapper code
Hoover, Jacob
Jacob.Hoover at greenheck.com
Thu Jan 18 14:22:53 PST 2018
FormatString is needed only if your bundle needs the value for something. Leaving it as is, the engine will format it internally when it is consuming it.
From: Jon Earle [mailto:earlej at hotmail.com]
Sent: Thursday, January 18, 2018 12:29 PM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com>; WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: Passing value from bundle.wsx to bootstrapper code
Okay, both of those were needed, as you suggested. I never realized you needed the wrapper around the variable, but it makes sense now, to evaluate the variable content as a property.
<Variable Name="INSTALLDIR" bal:Overridable="yes" Value="[$(var.PlatformProgramFilesFolder)]Company\Client"/>
And the FormatString wrapper. Why do I need to use that - only to evaluate the property?
________________________________
From: Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>>
Sent: Wednesday, January 17, 2018 5:04 PM
To: WiX Toolset Users Mailing List
Cc: Jon Earle
Subject: RE: Passing value from bundle.wsx to bootstrapper code
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<mailto:wix-users at lists.wixtoolset.org>>
Cc: Jon Earle <earlej at hotmail.com<mailto: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" />
</Directory>
</Directory>
</Directory>
And that works fine. What am I missing?
Cheers!
Jon
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/
More information about the wix-users
mailing list