Using WixIIsExtension and localization variable errors on building localized installer

Oct 5, 2016 at 7:38 AM
Hi, Oleg!
I build localized ru-RU culture installer with standart UI that use WixIIsExtension.
The IIS extension messages are not localized into russian. So I got a lot of errors:
the localization variable (loc.configureiis) is unknown. please ensure the variable is defined.
In Wix project settings I can set "ru-RU,en-US" in the "Cultures to build" instead of "ru-RU" and existing (English) messages are used.

How can I specify a "fallback" culture in Wix#?
Coordinator
Oct 5, 2016 at 11:50 PM
I think it is already covered here: https://wixsharp.codeplex.com/discussions/645513
Oct 6, 2016 at 6:40 AM
Hello, Oleg!
Thanks for reply.

I tried to set up fallback language
project.Language = "en-US, ru-RU";

I've got an error:
The system cannot find the file 'ru-RU' with type 'Source'.
Coordinator
Oct 6, 2016 at 11:02 AM
Advanced Localisation isn't really in Wix# scope. The issue#72 was about adding to Wix# the ability to specify fallback culture. It's done now and ExcaliburKG has confirmed (a year ago) that the feature is working. Thus as far as Wix# is concerned nothing needs to be done and it's unlikely any Wix# tricks will help you to solve your problem.

I suggest that you build your msi with Project.BuildMsiCmd. This will create all required WiX source files and the batch file for building msi without Wix#. Analyse the XMLs, batch file itself, dig WiX documentation. There will be something.

I am only guessing that on your PC the localization files cannot be found by candle.exe/light.exe.

When you fix that you may face other problems too. This is what if I got for InstallFiles sample with project.Language = "fr-FR,en-US"; (both localization resources are present on my PC):
light.exe : error LGHT0309 : Failed to open merge module for validation. The most common cause of this error is specifying that the merge module supports multiple languages (using the Package/@Languages attribute) but not including language-specific embedded transforms. To fix this error, make the merge module language-neutral, make it language-specific, embed language transforms as specified in the MSI SDK at http://msdn.microsoft.com/library/aa367799.aspx, or disable validation.
And it compiles fine for project.Language = "en-US,fr-FR";

Good luck.
Oct 7, 2016 at 7:41 AM
Edited Oct 7, 2016 at 7:49 AM
Hello, Oleg!
What loclization resources do you mean? Where are they located on PC?

I use Project.BuildMsi
project.Language = "en-US, ru-RU";//space is present
I've got an error:
The system cannot find the file 'ru-RU' with type 'Source'.

project.Language = "ru-RU,en-US";
I've got:
light.exe : error LGHT0309 : Failed to open merge module for validation. The most common cause of this error is specifying that the merge module supports multiple languages (using the Package/@Languages attribute) but not including language-specific embedded transforms. To fix this error, make the merge module language-neutral, make it language-specific, embed language transforms as specified in the MSI SDK at http://msdn.microsoft.com/library/aa367799.aspx, or disable validation

project.Language = "en-US,ru-RU"; //no space
project.MajorUpgrade.DowngradeErrorMessage is in Russian.
I've got:
MyProduct.wxs: A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage project.Language = "en-US,ru-RU"; //no space
project.MajorUpgrade.DowngradeErrorMessage is in English.
Compiles successful, but UI is in English :(.


Using Project.BuildMsiCmd and commandLine I have the same errors.
Coordinator
Oct 7, 2016 at 10:08 AM
> What loclization resources do you mean? Where are they located on PC?
WiX localization resources are the *.wxl files consumed by light.exe. They are located in some of WiX SDK sub-folders.
I was only guessing that light could not locate required *.wxl. Though my guess may be wrong.

I suggest that you build your msi with Project.BuildMsiCmd. This will create all required WiX source files and the batch file for building msi without Wix#. Analyse the XMLs, batch file itself, dig WiX documentation. There will be something.
Anyway, did you try that suggestion I gave you?
Oct 19, 2016 at 6:09 AM
Hi, Oleg!
I want to set up Russian language and fallback English. I must use russian symbols in product's name and MajorUpgrade.DowngradeErrorMessage
project.Language = "en-US,ru-RU"

In generated wxs file
<Product Id="5fe30577-2574-2574-9695-1961ba25989c" Name="Сервис управления заявками" Language="1033" Codepage="Windows-1252" Version="0.0.1.0" UpgradeCode="5fe30577-2574-2574-9695-1961ba25889b" Manufacturer="MyCompany">
<Package InstallerVersion="200" Compressed="yes" SummaryCodepage="Windows-1252" Languages="1033,1049" Platform="x64" />
Language must be 1049 and Codepage must be Windows-1251

So I have several equal errors:
A string was provided with characters that are not available in the specified database code page '1252'. Either change these characters to ones that exist in the database's code page, or update the database's code page by modifying one of the following attributes: Product/@Codepage, Module/@Codepage, Patch/@Codepage, PatchCreation/@Codepage, or WixLocalization/@Codepage. C:\web-application-setup\WebApplicationSetup\Сервис управления заявками.wxs

Maybe, french symbols are specified in codepage 1252. So you doesn't have errors in your test.

If I don't use russian symbols in Project name, I don't have these errors.
But standart UI is in English.

I saw in process monitor what happened.
"C:\WixSharp\Wix_bin\bin\light.exe" -sw1076 -sw1079 -b "C:\web-application-setup\WebApplicationSetup" "C:\web-application-setup\WebApplicationSetup\RequestManagementService.wixobj" -out "C:\web-application-setup\WebApplicationSetup\RequestManagementService.msi" -ext "%WixLocation%\WixIIsExtension.dll" -ext "%WixLocation%\WixUIExtension.dll" -cultures:en-US,ru-RU
So installer isn't localized.

To do localized installer cultures must be:-cultures:ru-RU,en-US (I tested in command line).


To do localized installer:
  1. In generated wxs file Language and Codepage must be changed.
  2. Order of -cultures in light.exe command line parameter must be changed (ru-RU,en-US instead of en-US,ru-RU)
Coordinator
Oct 20, 2016 at 1:07 AM
Edited Oct 20, 2016 at 1:07 AM
> Language must be 1049 and Codepage must be Windows-1251
Then you need to use your language value in the way that reflects the language priority: project.Language = "ru-RU,en-US". This will produce the output you want:
 <Product Id="6f3...89c" Name="MyProduct" Language="1049" Codepage="windows-1251" Version="...">
    <Package  SummaryCodepage="windows-1251" Languages="1049,1033" Id="..." />
This will also change the light.exe arguments according your expectations:
... -ext "%WixLocation%\WixUIExtension.dll" -cultures:"ru-RU,en-US"
> Codepage must be changed...
You can change it. It's a project property:
project.Codepage = "windows-####";
> I saw in process monitor what happened.
You don't need to go through the pain of intercepting process. Follow the advice I gave a few times in this thread. Change your BuildMsi to BuildMsiCmd. After that you will be able to see in a plain view the command line parameters in the generated batch file. You will also be able to change these parameters as well as some WXS attributes and rerun the batch file again and again until you solve the problem or at least understand what is causing it.
Oct 20, 2016 at 7:47 AM
Hello, Oleg!
BuildMsi builds localized installer without any error.
project.Language = "ru-RU,en-US"

Changed Languages Attribute of the Package element in WixSourceGenerated event handler
XNamespace ns = "http://schemas.microsoft.com/wix/2006/wi";
document.Descendants(ns + "Package")
.ForEach(pack => pack.Attribute("Languages").Value = "1049");
Thank you for help.
Coordinator
Oct 21, 2016 at 12:56 AM
This is great.

Though I am not sure why did you need to post-adjust XML.

You wrote Language must be 1049 and Codepage.... So it already was:
<Product Id="6f3...89c" Name="MyProduct" Language="1049" Codepage="windows-1251" Version="...">
    <Package  SummaryCodepage="windows-1251" Languages="1049,1033" Id="..." />
Wasn't it what you needed?
Oct 21, 2016 at 6:12 AM
Languages must be "1049" too.

If Languages is "1049,1033" in Package:
<Package SummaryCodepage="windows-1251" Languages="1049,1033" Id="..." />
I 've got an error:
Failed to open merge module for validation. The most common cause of this error is specifying that the merge module supports multiple languages (using the Package/@Languages attribute) but not including language-specific embedded transforms. To fix this error, make the merge module language-neutral, make it language-specific, embed language transforms as specified in the MSI SDK at http://msdn.microsoft.com/library/aa367799.aspx, or disable validation
Coordinator
Oct 21, 2016 at 11:45 PM
It is strange. The WiX documentation describes it as:
Languages   String  The list of language IDs (LCIDs) supported in the package.
So it is expected to be a list. But if it works for you,... then it is the way to go.

As for XML manipulations, you can avoid dealing with complicated namespaces if you just use Six# extensions:
project.WixSourceGenerated += doc => doc.Root.Select("Product/Package")
                                             .SetAttribute("Languages", 1049);