Stephen Reindl
Stephen Reindl

Reputation: 5829

Include components in transforms

I have a wix project file containing the following structure:

cultures
- en
  - profile.mo
- de
  - profile.mo
...

I'm creating several MSI files containing the localized MSI strings.

What I like to achive is that the files for "de" and other languages are included in the specific MSI files.

This will reduce the overall size of the setup a lot. Currently I'm using conditions based on localization:

<Component Id="compLangDePluginMo" Guid="{YOUR-GUID}" >
    <Condition><![CDATA["!(loc.Localization)" = "de-de"]]></Condition>
    <File Id="fLangDePluginMo" Name="plugin.mo" Source="$(var.ProjectRef.ProjectDir)catalogs\de\de.mo" />
</Component>

where in every WXL file there's a statement like

<String Overridable="yes" Id="Localization">en-us</String>

or

<String Overridable="yes" Id="Localization">de-de</String>

The drawback is that all MSI files contain all language specific files.

P.S. The MO file is just an example. We are taking about several MB of language specific files, therefore there's no chance to just have the messages included in transformations.

Upvotes: 0

Views: 91

Answers (1)

PhilDW
PhilDW

Reputation: 20790

You can't have components in transforms (because files would need to go in the File table, in a CAB and so on).

If you have one neutral MSI file that means you'd have a bundle per language, the neutral MSI with the functionality and the language specific one. So you could have a WiX bundle/bootstrapper per language: the neutral MSI plus one language.

Why did you choose conditional components? There are situations where users can change those conditions and a repair would alter the installed state of the components (and sometimes that's a feature not a bug). Languages as Features could be a bit more predictable.

Also one separate MSI for all the language specific data can be useful so that functionality can change but the language MSI doesn't need rebuilding - doesn't reduce size though, which seems to be the issue.

One other note: sometimes qualified components are used to provide this functionality, where for example the app can use MsiProvideQualifiedComponentEx to install the appropriate language files, but I'm not sure that it would help in your case if your product is not multi-language (but it is single language).

If you're thinking about transforms you may as well go the whole way and look at patches. You could have the base MSI with no languages and another "identical" MSI that contains (for example) the de-de changes ( as long as you are careful with the components) and then ship the base MSI with a patch per language, applying the patch according to the system. A bundle could apply the base plus the appropriate patch. Also a patch can be applied to an administrative install, so you'd then have an installable image but with loose files, if that's acceptable.

Chris makes an interesting point about transforms adding loose external files, but it's not clear (at least to me) if it's actually possible given the changes required to the base MSI (marking mixed files, dealing with file hashes and so on).

Upvotes: 2

Related Questions