WIX Toolset - WiX Toolset
heat.exe dir "Your_Project_Path" -cg Package -gg -sfrag -template fragment -out temp.wxs
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="7F503FBC-5FD5-4AFB-9E02-87088B2A5027" Name="Your_Product_Name" Language="1033" Version="1.0.0" Manufacturer="Developer_Name" UpgradeCode="81519c22-b44c-48c0-bf19-f045500d8a37">
<Package Id='*' Keywords='Installer' Description="Description of this Installer"
Comments='Something you want to comment' Manufacturer='Developer_Name'
InstallerVersion='100' Languages='1033' Compressed='yes' />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<!-- 打包过程中,不生成额外的cab文件,只会生成一个单独的安装程序文件 -->
<Media Id="1" Cabinet="Cab1.cab" EmbedCab="yes" />
<!-- Feature中的Component就是会被打包的内容,Id为后面定义的component组件的Id -->
<Feature Id='Complete' Title='Installer_Name' Level='1'>
<ComponentRef Id='MainExecutable' />
<ComponentRef Id='ProgramMenuDir' />
<ComponentGroupRef Id="Package" />
</Feature>
<!-- 设置安装过程中的默认路径(Value) -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<!-- 选择安装过程的UI样式,参考官方文档 -->
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
<!-- 自定义安装过程中显示的内容,License文件、banner图片、Dialog图片,图片格式可参考官方文档 -->
<WixVariable Id="WixUILicenseRtf" Value="Your_Project_Path\License.rtf" />
<WixVariable Id="WixUIBannerBmp" Value="Your_Project_Path\banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="Your_Project_Path\dialog.bmp" />
<!-- 定义Icon -->
<Icon Id="app.exe" SourceFile="Your_Project_Path\app.exe" />
</Product>
<Fragment>
<!-- 定义默认安装路径, "TARGETDIR"、"ProgramFilesFolder",为Wix关键字 -->
<!-- "INSTALLDIR",自定义ID, "Installation_Folder_Name", 安装目录的名称 -->
<!-- 此设置下,默认路径为:"C:\Program Files (x86)\Installation_Folder_Name" -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="Installation_Folder_Name">
<!-- 定义Component,Id可自定义,Guid 可用相关工具生成,为确保兼容性,所有字母大写, -->
<Component Id="MainExecutable" Guid="4D6724F4-FCCD-45BE-AE76-A17E6EF52674">
<!-- 定义Component中包含的文件,一个Component中可包含多个文件 -->
<File Id="DWLCEXE" Name="app.exe" Source="Your_Project_Path\app.exe" KeyPath="yes">
<!-- 定义快捷方式 -->
<Shortcut Id="startmenuDWLC10" Directory="ProgramMenuDir" Name="DWLC Greatec M3"
WorkingDirectory='INSTALLDIR' Icon="app.exe" IconIndex="0" Advertise="yes" />
<Shortcut Id="desktopDWLC10" Directory="DesktopFolder" Name="DWLC Greatec M3"
WorkingDirectory='INSTALLDIR' Icon="app.exe" IconIndex="0" Advertise="yes" />
</File>
</Component>
</Directory>
</Directory>
<!-- 卸载后,删除相应的快捷方式,具体可参考官方文档 -->
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="DWLC Greatec M3">
<Component Id="ProgramMenuDir" Guid="215DBA0A-1037-4011-8294-505F05B04204">
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
<RegistryValue Root='HKCU' Key='Software\[Manufacturer]\[ProductName]' Type='string' Value='' KeyPath='yes' />
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
</Fragment>
<!-- 从temp.wxs中复制的内容,利用heat.exe生成,包含项目文件夹的所有内容 -->
<Fragment>
<!-- Id 必须与前面保持一直 -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="cmp6FB3FEE7CE6997D320BE35F806D58FAF" Guid="{45AB4823-ED77-4840-B680-45DA35B950E1}">
<File Id="fil89BB5CA2C9B2A7F57FD2F15883D3763E" KeyPath="yes" Source="Your_Project_Path\xx1.dll" />
</Component>
<!-- 因为之前单独定义过app.exe,所以此处将其注释掉 -->
<!-- <Component Id="cmp30CC91312ED0AD2C2D4EED633AA299C3" Guid="{0CA468B5-2716-4208-93C7-D64BC20F04EE}">
<File Id="fil09B510D7AD2022C92336AAFF4207563E" KeyPath="yes" Source="Your_Project_Path\app.exe" />
</Component> -->
<Component Id="cmpC32E26C3450E497DC6B040064E22F874" Guid="{519D1BA4-BFC8-4B89-9180-C5FA88D12430}">
<File Id="fil2BE574489D23056A361B35B7316F381D" KeyPath="yes" Source="Your_Project_Path\xx2.dll" />
</Component>
<Component Id="cmpDCAF26179A917EDF4A24FCD84E4DD931" Guid="{4736E7A8-1180-44CD-A2D0-B91225372BD5}">
<File Id="filE8A91A263295B0B8CA6B1CA52839CB70" KeyPath="yes" Source="Your_Project_Path\xx3.dll" />
</Component>
<!-- 此处省略一万字。。。 -->
</DirectoryRef>
</Fragment>
<!-- 从temp.wxs中复制的内容,利用heat.exe生成,引用Component Id成一个ComponentGroup,以便在Feature中添加。 -->
<Fragment>
<ComponentGroup Id="Package">
<ComponentRef Id="cmp6FB3FEE7CE6997D320BE35F806D58FAF" />
<!-- 因为之前单独定义过app.exe,所以此处将其注释掉 -->
<!-- <ComponentRef Id="cmp30CC91312ED0AD2C2D4EED633AA299C3" /> -->
<ComponentRef Id="cmpC32E26C3450E497DC6B040064E22F874" />
<ComponentRef Id="cmpDCAF26179A917EDF4A24FCD84E4DD931" />
<!-- 此处省略一万字。。。 -->
</ComponentGroup>
</Fragment>
</Wix>
candle.exe Example_Installer.wxs
light.exe -ext WixUIExtension Example_Installer.wixobj