メインとなるソースファイルです。
{YOUR-GUID}のところは全て個別のGUIDを生成して置き換えてください。
ファイル先頭ではプリプロセッサ変数を定義しています。この変数の値によって、生成されるmsiが色々変わるようになってます。
<!– Files –>と書いてある部分はheatで生成しても良いと思います。
<?xml version="1.0" encoding="utf-8"?>
<?define ProductName = "製品名" ?>
<?define Manufacturer = "製造者" ?>
<?define SrcDir = "$(sys.CURRENTDIR)src\" ?>
<?define MainExeFileName = "hoge.exe" ?>
<?define ReadmeFileName = "readme.txt" ?>
<?define UseCustomUI = "yes" ?>
<?define AppRegKey = "Software\$(var.Manufacturer)\$(var.ProductName)" ?>
<?define Compressed = "no" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="{YOUR-GUID}"
UpgradeCode="{YOUR-GUID}"
Name="$(var.ProductName)"
Manufacturer="$(var.Manufacturer)"
Version="1.0.0.0"
Language="1041" Codepage="932">
<Package InstallerVersion="200" Compressed="$(var.Compressed)" />
<?if $(var.Compressed)="yes" ?>
<MediaTemplate EmbedCab="yes" />
<?else ?>
<Media Id="1" DiskPrompt="DISK1" />
<Property Id="DiskPrompt" Value="インストールディスク [1]" />
<?endif ?>
<Icon Id="MainIcon" SourceFile="$(var.SrcDir)$(var.MainExeFileName)" />
<Property Id="ARPPRODUCTICON" Value="MainIcon" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="ProgramFiles">
<Directory Id="ProgramFilesManufacturer" Name="$(var.Manufacturer)">
<Directory Id="INSTALLDIR" Name="$(var.ProductName)">
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="AppStartMenuDir" Name="$(var.Manufacturer) $(var.ProductName)">
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop">
</Directory>
</Directory>
<Feature Id="EssentialFeature" Level="1">
<ComponentGroupRef Id="EssentialFiles" />
<ComponentRef Id="EssentialRegistries" />
<ComponentRef Id="EssentialShortcuts" />
<ComponentRef Id="EssentialDesktopShortcut" />
</Feature>
<ComponentGroup Id="EssentialFiles" Directory="INSTALLDIR">
<Component Id="file0001" Guid="{YOUR-GUID}">
<File Id="file0001" KeyPath="yes" Source="$(var.SrcDir)$(var.MainExeFileName)" />
</Component>
<Component Id="file0002" Guid="{YOUR-GUID}">
<File Id="file0002" KeyPath="yes" Source="$(var.SrcDir)hoge.dat" />
</Component>
<Component Id="file0003" Guid="{YOUR-GUID}">
<File Id="file0003" KeyPath="yes" Source="$(var.SrcDir)$(var.ReadmeFileName)" />
</Component>
</ComponentGroup>
<DirectoryRef Id="AppStartMenuDir">
<Component Id="EssentialShortcuts" Guid="{YOUR-GUID}">
<RegistryValue Root="HKCU" Key="$(var.AppRegKey)" Name="InstalledStartMenuShortcut" Type="integer" Value="1" KeyPath="yes" />
<RemoveFolder Id="AppStartMenuDir" On="uninstall" />
<Shortcut Id="startMenuShortcut0001" Name="$(var.ProductName)" Target="[INSTALLDIR]$(var.MainExeFileName)" WorkingDirectory="INSTALLDIR" />
</Component>
</DirectoryRef>
<Property Id="INSTALLDESKTOPSHORTCUT" Value="1" />
<DirectoryRef Id="DesktopFolder">
<Component Id="EssentialDesktopShortcut" Guid="{YOUR-GUID}">
<Condition>INSTALLDESKTOPSHORTCUT</Condition>
<RegistryValue Root="HKCU" Key="$(var.AppRegKey)" Name="InstalledDesktopShortcut" Type="integer" Value="1" KeyPath="yes" />
<Shortcut Id="desktopShortcut0001" Name="$(var.ProductName)" Target="[INSTALLDIR]$(var.MainExeFileName)" WorkingDirectory="INSTALLDIR" />
</Component>
</DirectoryRef>
<DirectoryRef Id="INSTALLDIR">
<Component Id="EssentialRegistries" Guid="{YOUR-GUID}">
<RegistryKey Root="HKCU" Key="$(var.AppRegKey)" ForceCreateOnInstall="yes" ForceDeleteOnUninstall="yes">
<RegistryValue Type="string" Name="InstalledPath" Value="[INSTALLDIR]" KeyPath="yes" />
</RegistryKey>
</Component>
</DirectoryRef>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<WixVariable Id="WixUIBannerBmp" Value="banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="dialog.bmp" />
<?if $(var.UseCustomUI) = "yes" ?>
<UIRef Id="MyUI_InstallDir" />
<?if $(var.MainExeFileName) And $(var.MainExeFileName)!="" ?>
<Property Id="MYUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="プログラムを実行する" />
<Property Id="MYUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="LaunchApplication" Directory="INSTALLDIR" ExeCommand="[INSTALLDIR]$(var.MainExeFileName)" Return="asyncNoWait" />
<UI>
<Publish Dialog="MyExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">MYUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<?endif ?>
<?if $(var.ReadmeFileName) And $(var.ReadmeFileName)!="" ?>
<Property Id="MYUI_EXITDIALOGOPTIONALCHECKBOXTEXT2" Value="Readmeを開く" />
<Property Id="MYUI_EXITDIALOGOPTIONALCHECKBOX2" Value="1" />
<Property Id="WixShellExecTarget" Value="[INSTALLDIR]$(var.ReadmeFileName)" />
<CustomAction Id="LaunchReadme" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
<UI>
<Publish Dialog="MyExitDialog" Control="Finish" Event="DoAction" Value="LaunchReadme">MYUI_EXITDIALOGOPTIONALCHECKBOX2 = 1 and NOT Installed</Publish>
</UI>
<?endif ?>
<UI>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="MyInstallDirDlg">1</Publish>
<Publish Dialog="MyInstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
</UI>
<?else ?>
<UIRef Id="WixUI_InstallDir" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="プログラムを実行する" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<CustomAction Id="LaunchApplication" Directory="INSTALLDIR" ExeCommand="[INSTALLDIR]$(var.MainExeFileName)" Return="asyncNoWait" />
<UI>
<Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
</UI>
<UI>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
</UI>
<?endif ?>
</Product>
</Wix>