Creating localized WIX 3.6 bootstrappers.

Matt Varblow picture Matt Varblow · Jun 28, 2012 · Viewed 9.3k times · Source

I created a WIX project in Visual Studio 2010 over a year ago. It creates an MSI file and a bootstrapper setup.exe. Actually, it creates that pair of files for two languages - English and French. I am just now integrating this project into our TFS CI builds. I'm having trouble getting the CI build to generate the bootstrapper setup.exe files.

We've recently upgraded Wix on all our build servers to Wix 3.6 RC. So, I thought I'd give Burn a try instead of using the old style of bootstrapper. I added a new Bootstrapper project to my solution. The bootstrapper project includes a simple bundle.wxs that just loads the MSI generated by my old MSI project. However, when I try to build I get the following error:

error LGHT0103: The system cannot find the file 'C:\Tf\Advantage\Dev\Solution\Configuration\LaunchPad.Wix\bin\Release\fr-fr\LaunchPad.msi;C:\Tf\Advantage\Dev\Solution\Configuration\LaunchPad.Wix\bin\Release\en-us\LaunchPad.msi'.

My package reference in the bundle looks like this:

<MsiPackage Id="MyApplication" SourceFile="$(var.LaunchPad.Wix.TargetPath)" />

LaunchPad.Wix is the name of the Wix MSI project. If I change the LaunchPad.Wix project to build only one language then it works fine. It looks to me like the bootstrapper project type just doesn't support building setup files for multiple languages. Is this true? Any suggestions for a workaround?

Edit

Upon further investigation, I wonder if bootstrapper projects even support localization. I tried setting my Wix MSI project to create only fr-fr. The setup.exe that my bootstrapper project created with English. When I edit the project properties for the bootstrapper project the "Cultures to build" field is locked down and blank. How would I build a non-english bootstrapper? Is this possible yet?

Answer

Bob Arnson picture Bob Arnson · Jul 9, 2012

There are several things going on here:

  1. If you use multiple Cultures, you can't use TargetPath in something outside MSBuild that expects a single filename. As you found, TargetPath is a list of the localized files that were built. However, you can use TargetPath if you qualify the .msi package's output language: <MsiPackage SourceFile="$(var.TestMsi.en-US.TargetPath)" Id="MsiEnUs" />

  2. If you want to create one bootstrapper that can install either/both en-US and fr-FR, you'll need to list each .msi package separately in its own MsiPackage element.

  3. If you want to create two bootstrappers, one en-US and one fr-FR, you'll need to invoke the bootstrapper .wixproj twice, once for each language. Bootstrappers don't support the Cultures "trick" -- it's problematic to produce two outputs from a single invocation of MSBuild (witness the TargetPath problem).

If you're using WixStandardBootstrapperApplication, it automatically tries to localize the UI based on the user UI language, falling back to the system UI language, and finally falling back to English. It looks for localized strings in directories named after the LCID, so you'd have payloads like this:

<Payload Name="1033\thm.wxl" SourceFile="..." />
<Payload Name="1036\thm.wxl" SourceFile="..." />

Unfortunately, WixStandardBootstrapperApplication strings are currently available only for en-US. That's why an fr-FR bootstrapper shows UI in English. You'd need to localize the WiX source file HyperlinkTheme.wxl or RtfTheme.wxl (depending on which theme you use). Both of these files are in src\ext\BalExtension\wixstdba\Resources.