Вопрос

I have a created a multilanguage installer using WiX. I am running the installer from command line using command "msiexec /i myinstaller.msi TRANSFORMS=":1041" and it is working fine. Now I have created a language selection dialog using bootstrapper. How can I pass the selected language to my WiX installer to launch as per selected language? I got this idea from following links:

  1. Can we localize WIX msi and bundle using language selection UI at runtime?
  2. http://wix.tramontana.co.hu/tutorial/transforms/morphing-installers

My bundle has <MsiPackage SourceFile="myinstaller.msi" DisplayInternalUI="yes" >

I have this screen as a result of my custom UI using Burn from WiX toolset:

enter image description here

I want somehow to execute command msiexec /i myinstaller.msi TRANSFORMS=":1041" if I select Japanese or msiexec /i myinstaller.msi TRANSFORMS=":1031" if I select German and press OK.

Please tell me what I should do for this problem. Is there any other way to do this? If yes, then please tell me. Some code sample would be a better help.

Это было полезно?

Решение 2

Finally I got the solution. Bootstrapper UI for language selection can be created as described here. After that, I wrote following code in my button click event to launch the msi in selected language:

Bootstrapper.Engine.StringVariables["CommandArgs"] = ":1031";
Bootstrapper.Engine.Plan(Wix.LaunchAction.Install);
break;
....
....
this.Close(); //outside of switch statement
break;

The above code will use CommandArgs as an MSI property.Then I added following code to my bundle.wxs file

<MsiPackage Id="mypackage" SourceFile="myinstaller.msi" DisplayInternalUI="yes">
   <MsiProperty Name="TRANSFORMS" Value="[CommandArgs]"/>
</MsiPackage>

Worked exaclty the way I wanted. This code is same as launching msi from command line using following command

msiexec /i myinstaller.msi TRANSFORMS=":1031"

The only issue is that it is taking some time to launch MSI after language is selected from above UI.

Другие советы

Unfortunately, the transform must be applied as the MSI is being opened. That means, you will need that bootstrapper up front to pass the appropriate command-line to the Windows Installer to apply the correct transform.

After getting the UI in the bootstrapper to ask the user what language to display, (combobox or something?) I'd probably just do a ShellExecute() and format the command-line arguments like:

("/i myinstaller.msi TRANSFORMS=\":%d\", dwLanguageIdFromComboBox)

That would launch the installer with the right UI and your bootstrapper can go away.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top