3

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.

Community
  • 1
  • 1
DTdev
  • 538
  • 1
  • 18
  • 32

2 Answers2

5

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.

Rob Mensching
  • 33,834
  • 5
  • 90
  • 130
  • Thanks for the answer Rob. I actually want to know how can I run the above command from my bootstarpper? I am able to launch language dialog from bootstrapper which is launching my installer after OK button of this dialog. I don't know how can i launch LOCALIZED installer after OK. – DTdev May 07 '13 at 16:51
  • I am still not sure how i can run this command to a bundled package as OK button is calling "LaunchAction.Install". What is the way to run this? – DTdev May 08 '13 at 11:11
  • Are you using Burn from the WiX toolset for your bootstrapper? If so, can you please update your question to make that more clear? If not, I don't understand what `LaunchAction.Install` is so can you update your question to make that more clear? – Rob Mensching May 08 '13 at 14:31
  • Yes, I'm using Burn that has been created using WPF as described in a book by Nick Ramirez or at http://bryanpjohnston.com/2012/09/28/custom-wix-managed-bootstrapper-application/. I'm not sure how can I run some command on a bundled MSI on a button click. I have updated the question. Please let me know in case of further clarification, if needed. – DTdev May 08 '13 at 15:47
5

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.

DTdev
  • 538
  • 1
  • 18
  • 32
  • I can't figure out how to create executable to run select dialog and then msi – bgplaya Nov 11 '14 at 14:08
  • This dialog can be created using bootstrapper. Screenshot is posted in question. Do you want to know how to use bootstrapper to launch MSI? – DTdev Nov 12 '14 at 05:55
  • Yes, exactly. Did you create dialog with C# or using Wix? I'll greatly appreciate if you could provide sources. – bgplaya Nov 12 '14 at 09:12
  • I've already figured out, but there is one thing that I don't know is how to hide dialog after selecting dialog. When I tryed to do that msi became hidden too. – bgplaya Nov 12 '14 at 23:02
  • i have updated the code. I am using this.close() to close the dialog. Are you using DisplayInternalUI="yes" in your bundle as mentioned in above code? – DTdev Nov 13 '14 at 08:25
  • Yes, I do use it because my installer logic is in msi but not in bootstrapper. `this.Close();` closes msi too, but I need to close(hide) only language select dialog. – bgplaya Nov 13 '14 at 09:35
  • I've figured out by myself, anyway i appreciate you help! – bgplaya Nov 13 '14 at 18:52