初步介紹 WIX 之後, 可是該安裝只有最基本的 --- 安裝中...
太陽春了, 要如何產生基本的安裝對話窗呢?
首先, 參考 : http://wix.sourceforge.net/manual-wix2/WixUI_dialog_library.htm
因為我們用 VS2008 + Voltive, 先把 UI Extension DLL 參考進來吧.
透過 References 按右鍵, 我們可以加入 WIX 的參考 DLL.
之後, 可以在 WIX 安裝目錄的 bin當中 (一般是 C:\Program Files\Windows Installer XML V3\bin) 找到一些可以參考的 DLL.
因為要使用 UI, 所以當然是選 WixUIExtension.dll 囉!
Okay, 然後, 在 wxs 檔案中的 Product 內加入 <UIRef Id="WixUI_Minimal" />,如下:
<Product ....>
...
<UIRef Id="WixUI_Minimal" />
...
</Product>
這樣就有最基本的對話窗囉!
除了 WixUI_Minimal (最基本), 當然還有
WixUI_Mondo : 幾乎所有的對話窗都有了.
WixUI_FeatureTree : 從 WixUI_Mondo 變化而來, 只缺少了 SetupTypeDialog (安裝類型 Dialog)
WixUI_InstallDir: 不讓使用者選擇 SetupType and Features, 但是讓使用者選擇安裝目錄.
那...如果上面的還不夠, 就只能自訂 Dialog 囉, 自訂 Dialog 從無到有是很麻煩的一件事, 所以最簡單的方法是, 從上面四個基本的 Dialog UI 模組 copy 下來,
然後自己更改, 這樣最快了!
比方說, <UIRef Id="WixUI_Mondo" /> , 可以去找 WixUI_Mondo.wxs 的原始碼, 改掉 UI 的 ID , 就變成下面的 code:
1: <UI Id="MyWixUI">
2: <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
3: <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
4: <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
5: <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
6: <Property Id="WixUI_Mode" Value="Mondo" />
7: <DialogRef Id="ErrorDlg" />
8: <DialogRef Id="FatalError" />
9: <DialogRef Id="FilesInUse" />
10: <DialogRef Id="MsiRMFilesInUse" />
11: <DialogRef Id="PrepareDlg" />
12: <DialogRef Id="ProgressDlg" />
13: <DialogRef Id="ResumeDlg" />
14: <DialogRef Id="UserExit" />
15: <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
16: <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
17: <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
18: <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
19: <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
20: <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
21: <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
22: <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
23: <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
24: <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
25: <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
26: <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
27: <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
28: <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
29: <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
30: <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
31: <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
32: <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
33: <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
34: <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
35: </UI>
36: <UIRef Id="WixUI_Common" />
就從這個開始修改起, 會快速不少.
...
Read more.