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 &quot;[SOMEFILE]&quot;'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

转载于:https://www.cnblogs.com/yfann/archive/2012/07/27/2611698.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值