What we've got on WiX?
截止到现在,我们已经建立起一个基本的Installer框架了:有了要安装的文件,决定了安装到哪儿(路径),可以和用户简单的交互(UI),安装完毕后可以让用户快速启动(快捷方式,注册表),当然我们还做了一切异常处理(在Pre-checking里)~嗯,一个简单的可以work的Setup出来了,至少程序可以被比较正确的安装,修复和卸载,程序也能正常运行,一切看起来都不错~也时时候停下来好好做个Review了,结合Code梳理一下WiX的相关知识点.
我们从命名空间开始
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension">
下来是最重要的产品信息
<Product Id="e6ecf2a7-b03c-4b3f-ace8-6179ab62e4c7" Name="WixProject" Language="1033" Version="1.0.0.0" Manufacturer="WixProject" UpgradeCode="b3d503b8-4f21-4116-8562-6ff1e0e16a28">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
再看文件目录的组织方式
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="WixProject">
<Component ...>
......
</Component>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Windows Forms Application">
<Component ...>
......
</Component>
</Directory>
</Directory>
......
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="WixProject">
<Component ...>
......
</Component>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder" Name="Programs">
<Directory Id="ProgramMenuDir" Name="Windows Forms Application">
<Component ...>
......
</Component>
</Directory>
</Directory>
......
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
基本上就这么多需要强调的~下个阶段,我们将继续讨论添加自定义UI,Custom Action等,请继续关注!