Beware localization variables

Loc variables — using !( syntax to refer to strings defined in a .wxl file — let you use a single set of source files to build multiple localized installers. Common uses include obvious localizable strings like the product name and error messages. Slightly less common, but just as important to the localization process, are strings that aren’t visible to the user, like product-code GUIDs. They work great but there’s a risk: Loc strings aren’t subject to the same validation and correction code that “normal” strings go through. GUIDs are a perfect example. Normal strings in a .wxs source file are validated and normalized by the compiler, adding {braces} and uppercasing them as necessary to fit the Windows Installer rules for GUIDs.

There’s an open feature request to get some of the same validation done for loc strings. Maybe some weekend…

Executive summary

When you use GUIDs in loc strings, make sure they’re uppercase and in braces.


Loc variables are one type of bind-time variable. Bind-time variables are resolved at, well, bind time, which is part of the linking/binding job that Light.exe does. Preprocessor variables, using $( syntax, are resolved by Candle.exe. (Technically, preprocessing, as the pre- prefix implies, happens even before compilation.) Since it’s the compiler in Candle.exe that does the deepest validation, bind-time variables miss out on it. For now, anyway.