I need to use variable in WIX localization file WIXUI_en-us.wxl. I tried use it like this:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product $(var.InstallationVersionForGUI) is already installed</String>
But it doesn't work. And when I declared property and used it this way:
<String Id="Message_SomeVersionAlreadyInstalled" Overridable="yes">A another version of product [InstallationVersionForGUI] is already installed</String
>
doesn't work either.
Where was I wrong?
Thanks for help and your time.
Any environment variable can be referenced with the syntax $(env. VarName). For example, if you want to retrieve the environment variable %_BuildArch%, you would use $(env. _BuildArch).
Right click on your project in Solution Explorer and select Add > New Item... Select WiX Localization File, give the file an appropriate name, and select Add.
Localization strings are processed at link time, so you can't use $(var) preprocessor variables. Using a [property] reference is supported, as long as the place where the localization string is used supports run-time formatting (e.g., using the Formatted field type).
Your second method should work just fine. This is the same method used by the default .wxl
files.
For example, in your .wxl
file you would declare your string:
<String Id="Message_Foo">Foo blah blah [Property1]</String>
And in your .wxs
file, you declare the property. If you wish, you can declare the property to match a WiX variable (which it sounds like you're trying to do)
<Property Id="Property1">$(var.Property1)</Property>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With