Wix 教程
相关命令
candle Sample.wxs
light Sample.wixobj
light -ext WixUIExtension SampleWixUI.wixobj //编译带UI的安装包
ligth -ext WixUIExtension -cultures:zh-tw SampleWixUI.wixobj //本地化,支持内嵌的语言
ligth -ext WixUIExtension -loc path/WixUI_zh-cn.wxl -out SampleWixUI.msi SampleWixUI.wixobj //对内嵌不支持的语言本地化时,要编写本地化文件wxl
msiexec /i Sample.msi /l* Sample.log //安装并生成日志
msiexec /x Sample.msi //卸载
使用界面
<UIRef Id="WixUI_Mondo" />
WixUI_Mondo //完整界面,可以选择安装类型typical, custom and complete,当typical和complete安装的feature不同时,使用此界面
WixUI_FeatureTree //只用custom类型
WixUI_InstallDir //只能选择路径
WixUI_Minimal //只有欢迎界面和licence界面
WixUI_Advanced //类似WixUI_Minimal
<WixVariable Id="WixUILicenseRtf" Value="path\License.rtf" /> //替换license内容
<WixVariable Id="WixUIBannerBmp" Value="path\banner.bmp" />
<WixVariable Id="WixUIDialogBmp" Value="path\dialog.bmp" />
<WixVariable Id="WixUIExclamationIco" Value="path\exclamation.ico" />
<WixVariable Id="WixUIInfoIco" Value="path\information.ico" />
<WixVariable Id="WixUINewIco" Value="path\new.ico" />
<WixVariable Id="WixUIUpIco" Value="path\up.ico" />
创建web app installer(适用于wix 3.5)
1)对于wix引入的项目,使用harvest功能可以自动生成
引用要发布的项目,选中引用的项目,harvest属性设为true
由于wix3.6的harvest功能默认关闭,需要在wixproj的propertygroup中加入<EnableProjectHarvesting>true</EnableProjectHarvesting>,然后对引入的项目就可以使用<ComponentGroupRef Id="Product.Generated"/>(harvest功能有bug,一些依赖的程序集会丢失)
2)创建wix项目
引用WixIIsExtension
引用要发布的web项目[Myweb]
对于引用的web项目直接使用harvest功能,会造成bin文件夹丢失等问题,需要自定义:
1.在wixproj中的ProjectReference中加入<WebProject>True</WebProject>以表明是web项目
2.在wixproj文件中的project中加入
<Target Name="BeforeBuild">
<MSBuild
Projects="%(ProjectReference.FullPath)"
Targets="Package"
Properties="Configuration=$(Configuration);Platform=AnyCPU"
Condition="'%(ProjectReference.WebProject)'=='True'" />
<PropertyGroup>
<LinkerBaseInputPaths>%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\</LinkerBaseInputPaths>
</PropertyGroup>
<HeatDirectory
OutputFile="%(ProjectReference.Filename).wxs"
Directory="%(ProjectReference.RootDir)%(ProjectReference.Directory)obj\$(Configuration)\Package\PackageTmp\"
DirectoryRefId="INSTALLLOCATION"
ComponentGroupName="%(ProjectReference.Filename)_Project"
AutogenerateGuids="true"
SuppressCom="true"
SuppressFragments="true"
SuppressRegistry="true"
SuppressRootDirectory="true"
ToolPath="$(WixToolPath)"
Condition="'%(ProjectReference.WebProject)'=='True'" />
</Target>
3.rebuild wix项目,然后再项目中include生成的Myweb.wxs(3.6没成功)
4.添加<ComponentGroupRef Id="[Myweb]_Project" />
技巧
执行命令行
<CustomActionId='ExecNotepad'Directory='INSTALLDIR'Execute='immediate' ExeCommand='[SystemFolder]notepad.exe "[SOMEFILE]"'Return='ignore'/>
From:http://wix.tramontana.co.hu/tutorial/
From:http://msdn.microsoft.com/en-us/library/windows/desktop/aa372845(v=vs.85).aspx
Create a web app installer:http://blogs.planetsoftware.com.au/paul/archive/2011/02/20/creating-a-web-application-installer-with-wix-3.5-and-visual.aspx

浙公网安备 33010602011771号