原文:使用WIX打包客户端程序

用WPF为客户做了个小工具,打包的时候发现VS2012居然没有安装项目了,搜了下才知道现在推荐使用WIX来打包了http://wix.sourceforge.net/,我用的最新3.7的。

研究了下,发现有两个要点要记录下来,一是对简体中文的支持,二是自动安装.net Framework的支持;希望大家用到该工具的时候不要再走我的弯路。

1.对简体中文的支持,在这里http://www.cnblogs.com/wfwup/archive/2009/07/16/1524708.html下载的中文资源包,加入到项目里重新编译就可以了,原作者提供的是3.0的,发现在3.7下一样能用,感谢技术手札提供。

把我的Product.wxs文件和大家分享下:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> <Product Id="9C505667-71C4-40C7-8B60-2F186920158C" Name="产品名称" Language="2052" Codepage="936" Version="1.0.0.0" Manufacturer="公司名称" UpgradeCode="3b259853-ebce-47cf-aeef-ef4ef089a080">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate/>
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLFOLDER" />
<UIRef Id="WixUI_InstallDir" />
<Feature Id="ProductFeature" Title="OfflineViewer" Level="1">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="ShortcutComponents" />
</Feature>
</Product> <Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="OfflineViewer" />
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ShortcutMenuFolder" Name="产品名称" />
</Directory>
</Directory>
</Fragment> <Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<Component Id='ProductComponent' DiskId='1' Guid='6D98C7EE-6EF9-4747-8D03-E7AD0B6122BD'>
<File Name='CommonConfig.xml' Source="$(var.EIAC.AccountingArchivess.OfflineViewer.TargetDir)" />
<File Name='EIAC.AccountingArchivess.OfflineViewer.CustomControl.dll' Source="$(var.EIAC.AccountingArchivess.OfflineViewer.TargetDir)" />
<File Name='Offline.Common.dll' Source="$(var.EIAC.AccountingArchivess.OfflineViewer.TargetDir)" />
<File Name='EIAC.AccountingArchivess.OfflineViewer.exe' Source="$(var.EIAC.AccountingArchivess.OfflineViewer.TargetDir)" />
</Component>
<!-- </Component> -->
</ComponentGroup> <ComponentGroup Id="ShortcutComponents" Directory="ShortcutMenuFolder">
<Component Id="ApplicationShortcut" Guid="C919F5ED-D2B3-42E8-9F7C-63269274FE79">
<Shortcut Id="ApplicationStartMenuShortcut" Name="产品名称" Target="[INSTALLFOLDER]EIAC.AccountingArchivess.OfflineViewer.exe" WorkingDirectory="INSTALLFOLDER" />
<RemoveFolder Id="ShortcutMenuFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software/公司名称/产品名称" Name="installed" Type="integer" KeyPath="yes" Value="1" />
</Component>
</ComponentGroup>
</Fragment> </Wix>

2.自动安装.net Framework,参考了这篇文章:http://blog.csdn.net/duanzilin/article/details/5982296

用文本编辑器打开项目文件*.wixproj,在Project节点加入如下xml(请大家选择自己需要的.net版本)

 <ItemGroup>
<BootstrapperPackage
Include=".NETFramework,Version=v4.0,Profile=Client">
<Visible>False</Visible>
<ProductName>.NET Framework 4.0 Client</ProductName>
<Install>True</Install>
</BootstrapperPackage>
</ItemGroup>

<Target Name="AfterBuild">
<GenerateBootstrapper ApplicationFile="zh-cn\$(TargetFileName)"
ApplicationName="产品名称"
BootstrapperItems="@(BootstrapperPackage)"
ComponentsLocation="Relative"
CopyComponents="True"
OutputPath="$(OutputPath)"
Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\"/>
</Target>

保存,重新编译即可。那个Bootstrapper目录请大家按照自己电脑上的目录结构修改(一般好像都一样的)

Wix中添加自定义操作部分,因项目没用上也没研究。

使用WIX打包客户端程序的更多相关文章

  1. Wix打包系列(七) 添加系统必备组件的安装程序

    原文:Wix打包系列(七) 添加系统必备组件的安装程序 我们知道在vs的打包工程中添加系统必备组件是一件很容易的事情,那么在wix中如何检测系统必备组件并在安装过程中安装这些组件.这里以.Net Fr ...

  2. Wix打包系列(一)如何使用wix制作安装程序

    原文:Wix打包系列(一)如何使用wix制作安装程序 最近由于项目需要,需要给客户制作安装程序,一开始使用vs2005自带的打包工程来打包,但用了一段时间发现vs打包太死板,而且使用起来问题很多.收费 ...

  3. 使用Inno Setup 打包.NET程序,并自动安装.Net Framework

    使用Inno Setup 打包.NET程序,并自动安装.Net Framework http://www.cnblogs.com/xiaogangqq123/archive/2012/03/19/24 ...

  4. Wix打包相关资源

    1.自定义安装界面(WixUI_Custom.wxs) <?xml version="1.0" encoding="UTF-8"?> <Wix ...

  5. vs2010打包winform程序详解

    vs2010打包winform程序详解   最近一直在做winform程序,做完后程序打包很头疼,第三方打包工具,好用的花钱,不花钱的不好用,最后只能用vs自带的打包工具了! 打包过程vs2010(包 ...

  6. Wix打包系列(四) 自定义UI

    原文:Wix打包系列(四) 自定义UI 除了标准的安装界面,如果我们要在安装时需要提供一些额外的信息时,这时就需要自定义界面来显示和录入这些信息. 4.1  自定义对话框 如上一章中我们测试数据库的连 ...

  7. Wix打包系列 (六)制作升级和补丁包

    原文:Wix打包系列 (六)制作升级和补丁包 前面我们已经知道怎么制作一个完整安装包了,但我们的软件往往不能一次性就满足客户的需要,当客户需要我们给软件进行升级的时候,我们应该怎么做呢? 在这之前,我 ...

  8. Wix打包系列(五) 部署数据库

    原文:Wix打包系列(五) 部署数据库 很多人在使用vs进行打包的时候,经常会为数据库部署的问题犯愁,即便是重写Installer类的方法,也不是很可靠方便,下面我们来看看在wix中如何部署数据库. ...

  9. Wix打包系列(三)自定义Action(Custom Action)

    原文:Wix打包系列(三)自定义Action(Custom Action) 3.1 关于Action 我们已经知道如何生成具有标准安装界面的安装程序了,Windows Installer按照我们的界面 ...

随机推荐

  1. 安装windows7导致Ubuntu启动项消失的问题的解决

    系统原来是Ubuntu14,前两天安装win7后,启动直接是win7.也就是Ubuntu的启动项消失了. 在windows下尝试非常多方法,都以失败告终,最后选择Ubuntu下boot-repair软 ...

  2. EasyUI - Tabs 选项卡标签

    基本效果: 效果图: html代码: <div id="tab"> <div title="tab1" > <p>tab1& ...

  3. MEAN栈开发

    Nodejs之MEAN栈开发(二)----视图与模型 2016-06-02 08:30 by stoneniqiu, 92 阅读, 2 评论, 收藏, 编辑 上一节做了对Express做了简单的介绍, ...

  4. PHP学习之-1.6 PHP语句结束符

    PHP语句结束符 是不是我们在javascript,Java 的每一句代码结束的地方都有一个分号 ";" PHP的结束符号也是 ";". 注意:在PHP编程中需 ...

  5. LeetCode: LRU Cache [146]

    [题目] Design and implement a data structure for Least Recently Used (LRU) cache. It should support th ...

  6. Boost Thread学习笔记四

    barrierbarrier类的接口定义如下:  1 class barrier : private boost::noncopyable   // Exposition only 2 { 3 pub ...

  7. 【数据库摘要】12_Sql_存储过程

    SQL 存储过程 存储过程创建语法: create or replace procedure 存储过程名(param1 in type,param2 out type) as 变量1 类型(值范围); ...

  8. SVN权限解析规则详解(转)

    首先创建一个版本库后,会生成最初的目录结构和基本的配置文件,本文主要分析“authz”文件的内容:我们先抛开alias和groups不谈,将重点放在路径的权限配置上. 一. 权限格式 svn权限的基本 ...

  9. 可能性dp+减少国家HDU4336

    Card Collector Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Subm ...

  10. 桌面应用框架 OneRing

    框架目标 OneRing是一个跨平台的桌面应用框架.和Adobe AIR类似,它支持用html/js/css制作用户界面,与之不同的是,它的应用为本地程序,可以直接访问操作系统的数据. 架构 一个On ...