WiXインストーラーの使用許諾契約の文章を変更する
WiXインストーラーの使用許諾契約の文章を変更する手順を紹介します。
使用許諾契約の文章の作成
使用許諾契約の文章を作成します。rtf(Rich Text File)形式でする必要がありますので、ワードパッドを利用して使用許諾契約を作成します。
rtf形式の使用許諾契約のファイルが準備できました。
使用許諾契約のカスタマイズ
こちらの記事を参照して最小限のUIを持つインストーラーを作成します。
先ほど作成したlicense.rtfファイルを、プロジェクトのルートディレクトリに配置します。
Products.wxsファイルを下記に変更します。
Products.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="{B8D21526-447C-49F6-9868-24EFCDB02C25}" Name="MinimalUIInstallerCustom" Language="1033" Version="1.0.0.0" Manufacturer="iPentec" UpgradeCode="b9f823a5-3220-4c1a-8883-5b02520f8f9a">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes"/>
<UIRef Id="WixUI_Minimal" />
<WixVariable Id="WixUILicenseRtf" Value="license.rtf"/>
<Feature Id="ProductFeature" Title="MinimalUIInstallerCustom" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="MinimalUIInstallerCustom" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<DirectoryRef Id="INSTALLFOLDER">
<Component Id="Component1" Guid="{BE0399F6-8287-44B9-8252-8017A4935BBB}" DiskId="1">
<File Id="File01" Name="Document.txt" Source="Document.txt"/>
</Component>
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<ComponentRef Id="Component1" />
</ComponentGroup>
</Fragment>
</Wix>
解説
<WixVariable Id="WixUILicenseRtf" Value="license.rtf"/>
により、使用許諾契約のrtfファイルを指定します。
実行結果
プロジェクトをビルドします。結果出力ディレクトリにmsiファイルが作成されます。
msiファイルを実行します。下図の使用許諾契約書のダイアログが表示されます。表示される使用許諾契約書が先に作成したrtfファイルの内容になっています。
[使用許諾契約書に同意します]チェックボックスにチェックをします。チェック後[インストール]ボタンをクリックします。
インストールが始まります。
インストールが完了すると、下図の画面が表示されます。[完了]ボタンをクリックするとインストーラーが閉じられます。
使用許諾契約書の変更ができました。
著者
iPentecのメインプログラマー
C#, ASP.NET の開発がメイン、少し前まではDelphiを愛用