我正在设置一个可以显示不同EULA的安装程序,具体取决于最终用户在其操作系统中的本地化设置。我跟随this tutorial。我的本地化文件(.wxl)如下所示:
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="LANG">1033</String>
<String Id="LicenseRtf" Overridable="yes">\Lang\en-us\TestLicense.rtf</String>
<String Id="WelcomeDlgTitle">{\WixUI_Font_Bigger}[ProductName] [ProductVersion] Setup</String>
</WixLocalization>
我非常确定这部分是有效的,因为它肯定会在欢迎对话标题中添加版本号。如您所见,我为licenseRtf设置了一个可以被覆盖的变量。现在我的主.wxs文件看起来像这样:
<Dialog Id="LicenseAgreementDialogOverwritten" Width="370" Height="270" Title="!(loc.LicenseAgreementDlg_Title)">
<Control Id="LicenseAcceptedOverwrittenCheckBox" Type="CheckBox" X="20" Y="207" Width="330" Height="18" CheckBoxValue="1" Property="LicenseAcceptedOverwritten" Text="!(loc.LicenseAgreementDlgLicenseAcceptedCheckBox)" />
<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">CostingComplete = 1</Publish>
<Condition Action="disable">
<![CDATA[ LicenseAcceptedOverwritten <> "1" ]]>
</Condition>
<Condition Action="enable">LicenseAcceptedOverwritten = "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="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.LicenseAgreementDlgBannerBitmap)" />
<Control Id="LicenseText" Type="ScrollableText" X="20" Y="60" Width="330" Height="140" Sunken="yes" TabSkip="no">
<Text SourceFile="$(var.EULADir)\!(loc.LicenseRtf)" />
</Control>
<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="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)" />
</Dialog>
此代码中的键(我认为)是为EULA设置Text Sourcefile的行。您可以看到我已将源文件设置为在此位置查找: SourceFile =&#34; $(var.EULADir)!(loc.LicenseRtf)&#34; 即可。变量EULADir存储在我的Config.wxi文件中,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<Include>
<?define EULADir = "C:\SomeLongPathOnMyMachine\EULA" ?>
</Include>
所以,使用这段代码,我希望安装程序检查我的EULA目录并加载我的rtf文件...但是,当我运行我的安装程序时,显示的EULA是默认的EULA(即Lorem Ipsum等)。 )有谁知道为什么它没有正确加载我的rtf EULA文件?