[wix-users] Passing value from bundle.wsx to bootstrapper code
Jon Earle
earlej at hotmail.com
Wed Jan 17 13:54:57 PST 2018
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
More information about the wix-users
mailing list