creating language selection dialog using WiX

瘦欲@ 提交于 2019-12-03 17:09:58

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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!