还有另一种方法可以做到这一点,虽然它有点混乱,但它比 OP 提到的两种解决方法要少。并且信用到期,这个答案几乎是100%基于这篇文章http://weblogs.sqlteam.com/mladenp/archive/2010/04/15/WiX-3-Tutorial-Custom-EULA-License-and -MSI-localization.aspx,作者 Mladen Prajdić。
以下基于 WiX 3.5。
您创建 LicenseAgreementDlg 对话框的稍微修改的副本并将其包含在您的项目中。
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) Microsoft Corporation. All rights reserved.
The use and distribution terms for this software are covered by the
Common Public License 1.0 (http://opensource.org/licenses/cpl1.0.php)
which can be found in the file CPL.TXT at the root of this distribution.
By using this software in any fashion, you are agreeing to be bound by
the terms of this license.
You must not remove this notice, or any other, from this software.
-->
<!-- This is a modified version of LicenseAgreementDlg to support selection of localized versions of
the license file. It is very much based on this article:
http://sqlserverpedia.com/blog/sql-server-bloggers/wix-3-tutorial-custom-eula-license-and-msi-localization/ -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI>
<Dialog Id="LicenseAgreementKludge" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="340" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgDescription)" />
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="!(loc.LicenseAgreementDlgTitle)" />
<Control Id="LicenseAcceptedCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAcceptedKludge" Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" />
<Control Id="Print" Type="PushButton" X="112" Y="243" Width="56" Height="17" Text="!(loc.WixUIPrint)">
<Publish Event="DoAction" Value="WixUIPrintEula">1</Publish>
</Control>
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1</Publish>
<Condition Action="disable"><![CDATA[LicenseAcceptedKludge <> "1"]]></Condition>
<Condition Action="enable">LicenseAcceptedKludge = "1"</Condition>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">
<Text SourceFile="$(var.ProjectDir)\!(loc.LicenseRtf)" /> <!-- this value has been modified -->
</Control>
</Dialog>
</UI>
</Fragment>
</Wix>
在您的主要 WiX 源文件中,您添加以下代码以将新对话框“修补”到对话框序列中,而不是原来的:
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementKludge">1</Publish>
<Publish Dialog="LicenseAgreementKludge" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="LicenseAgreementKludge" Control="Next" Event="NewDialog" Value="InstallDirDlg">LicenseAcceptedKludge = "1"</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementKludge">1</Publish>
请注意,这是基于使用 WixUI_InstallDir 对话框集合 - 对于其他集合,例如 WixUI_Mondo,您可能必须通过查看源代码来修改上述内容。
最后,在每个本地化文件中放置一行,如下所示:
<String Id="LicenseRtf">en-us\MerliniaSMSGatewayLicense.en-us.rtf</String>
<String Id="LicenseRtf">da-dk\MerliniaSMSGatewayLicense.da-dk.rtf</String>
而且,当然,您可以按照指示放置本地化的许可证文件。我将许可证文件(和本地化文件)放在子文件夹中,但这不是必需的。
就像我说的,它有点乱,但它确实有效。