Source Reference: wix help document  -- WiX Toolset License

Using Patch Creation Properties 

A patch contains the differences between one or more pairs of Windows Installer packages. The tool PatchWiz.dll in the Windows SDK compares pairs of packages and produces a patch using a file called a Patch Creation Properties (PCP) file.

It is recommended that you download the latest Windows SDK to get the newest tools for building patches.

Setting Up the Sample

A Patch Creation Properties (PCP) file instructs PatchWiz.dll to generate a patch from differences in one or more pairs of packages. A patch contains the differences between the target and upgrade packages, and will transform the target package to the upgrade package. Both the target and upgrade packages are created below.

Create a directory that will contain the sample

Create a directory from which you plan on running the sample. This will be the sample root.

md C:\sample

Create two subdirectories

Under the sample root create two subdirectories called "1.0" and "1.1".

md C:\sample\1.0

md C:\sample\1.1

Create a text file called Sample.txt for 1.0

Create a text file in the "1.0" directory called Sample.txt and put some text in it telling you that it is the 1.0 version of the file.

echo This is version 1.0 > C:\sample\1.0\Sample.txt

Create a text file called Sample.txt for 1.1

Create a text file in the "1.1" directory called Sample.txt and put some text in it telling you that it is the 1.1 version of the file.

echo This is version 1.1 > C:\sample\1.1\Sample.txt

Create your product authoring in the sample root folder

Create your product authoring in the sample root folder called Product.wxs with the following contents:

<?xml version="1.0" encoding="UTF-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <Product Id="48C49ACE-90CF-4161-9C6E-9162115A54DD"

        Name="WiX Patch Example Product"

        Language="1033"

        Version="1.0.0"

        Manufacturer="Dynamo Corporation"

        UpgradeCode="48C49ACE-90CF-4161-9C6E-9162115A54DD">

        <Package Description="Installs a file that will be patched."

            Comments="This Product does not install any executables"

            InstallerVersion="200"

            Compressed="yes" />

        <Media Id="1" Cabinet="product.cab" EmbedCab="yes" />

        <FeatureRef Id="SampleProductFeature"/>

    </Product>

    <Fragment>

        <Feature Id="SampleProductFeature" Title="Sample Product Feature" Level="1">

            <ComponentRef Id="SampleComponent" />

        </Feature>

    </Fragment>

    <Fragment>

        <DirectoryRef Id="SampleProductFolder">

            <Component Id="SampleComponent" Guid="{C28843DA-EF08-41CC-BA75-D2B99D8A1983}" DiskId="1">

                <File Id="SampleFile" Name="Sample.txt" Source=".\$(var.Version)\Sample.txt" />

            </Component>

        </DirectoryRef>

    </Fragment>

    <Fragment>

        <Directory Id="TARGETDIR" Name="SourceDir">

            <Directory Id="ProgramFilesFolder" Name="PFiles">

                <Directory Id="SampleProductFolder" Name="Patch Sample Directory">

                </Directory>

            </Directory>

        </Directory>

    </Fragment>

</Wix>

Create your patch authoring in the sample root

Create your Patch Creation Properties (PCP) authoring in the sample root called Patch.wxs with the following content:

<?xml version="1.0" encoding="utf-8"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

    <PatchCreation

        Id="224C316C-5894-4771-BABF-21A3AC1F75FF"

        CleanWorkingFolder="yes"

        OutputPath="patch.pcp"

        WholeFilesOnly="yes"

        >

        <PatchInformation

            Description="Small Update Patch"

            Comments="Small Update Patch"

            ShortNames="no"

            Languages="1033"

            Compressed="yes"

            Manufacturer="Dynamo Corp"/>

        <PatchMetadata

            AllowRemoval="yes"

            Description="Small Update Patch"

            ManufacturerName="Dynamo Corp"

            TargetProductName="Sample"

            MoreInfoURL="http://www.dynamocorp.com/"

            Classification="Update"

            DisplayName="Sample Patch"/>

        <Family DiskId="5000"

            MediaSrcProp="Sample"

            Name="Sample"

            SequenceStart="5000">

            <UpgradeImage SourceFile="C:\sample\1.1\admin\product.msi" Id="SampleUpgrade">

                <TargetImage SourceFile="C:\sample\1.0\admin\product.msi" Order="2"     

                    Id="SampleTarget" IgnoreMissingFiles="no" />

            </UpgradeImage>

        </Family>

        <PatchSequence PatchFamily="SamplePatchFamily"

            Sequence="1.0.0.0"

            Supersede="yes" />

    </PatchCreation>

</Wix>

Note that SequenceStart must be greater than the last sequence in the File table in the target package or the patch will not install.

Build the Target and Upgrade Packages

Open a command prompt and make sure the following WiX and Windows Installer SDK tools are in your PATH.

  • Candle.exe
  • Light.exe
  • MsiMsp.exe
  • PatchWiz.dll
  • MSPatchC.dll
  • MakeCab.exe

Build the target package

candle.exe -dVersion=1.0 product.wxs

light.exe product.wixobj -out 1.0\product.msi

Perform an administrative installation of the target package

Msiexec.exe is used to perform an administrative installation but nothing is actually registered on your system. It is mainly file extraction.

msiexec.exe /a 1.0\product.msi /qb TARGETDIR=C:\sample\1.0\admin

Build the upgrade package

candle.exe -dVersion=1.1 product.wxs

light.exe product.wixobj -out 1.1\product.msi

Perform an administrative installation of the upgrade package

msiexec.exe /a 1.1\product.msi /qb TARGETDIR=C:\sample\1.1\admin

Build the Patch

The Patch.wxs file is compiled into a PCP file that is then processed by MsiMsp.exe to product the patch package.

candle.exe patch.wxs

light.exe patch.wixobj -out patch\1.1\patch.pcp

msimsp.exe -s patch\patch.pcp -p patch\1.1\patch.msp -l patch.log

Verify the Patch

To verify that the patch works, install the product and then the patch.

Install the 1.0 product

msiexec.exe /i 1.0\product.msi /l*vx install.log

Verify version 1.0

Go to "Program Files\Patch Sample Directory" and open Sample.txt. Verify that this is the 1.0 version. Close Sample.txt.

Install the patch

msiexec.exe /p patch\patch.msp /l*vx patch.log

Verify version 1.1

Go to "Program Files\Patch Sample Directory" and open Sample.txt. Verify that this is now the 1.1 version. Close Sample.txt.

Uninstall the patch

On Windows XP Service Pack 2 and Windows Server 2003, go to "Add/Remove Programs" in the Control Panel and make sure that Show Updates is checked. On Windows Vista and newer, go to "Programs" then "View installed updates" in the Control panel. Select "Sample Patch" from under "WiX Patch Example Product" and click the Uninstall button.

Go to "Program files\Patch Sample Directory" and open Sample.txt. Verify that this is again the 1.0 version. Close Sample.txt.

Uninstall the product

On Windows XP Service Pack 2 and Windows Server 2003, go to "Add/Remove Programs" in the Control Panel. On Windows Vista and newer, go to "Programs" then "Uninstall a program" in the Control Panel. Select "WiX Patch Example Product" and click the Uninstall button.

Restrictions

Please review restrictions on how patches must be built to avoid problem during patch installation.

Wix: Using Patch Creation Properties - Small Update的更多相关文章

  1. Wix: Using Patch Creation Properties - Minor Update

    Based on the project created in Wix: Using Patch Creation Properties - Small Update, Following chang ...

  2. From MSI to WiX, Part 1 - Required properties, by Alex Shevchuk

    Following content is directly reprinted from From MSI to WiX, Part 1 - Required properties Author: A ...

  3. WIX 安装部署教程(六) 为你收集的七个知识点

    前段时间整理5篇WIX(Windows Installer XML)的安装教程,但还不够完善,这里继续整理了七个知识点分享给大家.WIX最新版本3.8,点击下载 WIX安装部署(一)同MSBuild自 ...

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

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

  5. Windows 7: Update is not applicable to your computer

    https://www.sevenforums.com/windows-updates-activation/119088-update-not-applicable-your-computer.ht ...

  6. REST API设计指导——译自Microsoft REST API Guidelines(四)

    前言 前面我们说了,如果API的设计更规范更合理,在很大程度上能够提高联调的效率,降低沟通成本.那么什么是好的API设计?这里我们不得不提到REST API. 关于REST API的书籍很多,但是完整 ...

  7. Known BREAKING CHANGES from NH3.3.3.GA to 4.0.0

    Build 4.0.0.Alpha1 =============================   ** Known BREAKING CHANGES from NH3.3.3.GA to 4.0. ...

  8. Deploying JRE (Native Plug-in) for Windows Clients in Oracle E-Business Suite Release 12 (文档 ID 393931.1)

    In This Document Section 1: Overview Section 2: Pre-Upgrade Steps Section 3: Upgrade and Configurati ...

  9. Ehcache(2.9.x) - API Developer Guide, Write-Through and Write-Behind Caches

    About Write-Through and Write-Behind Caches Write-through caching is a caching pattern where writes ...

随机推荐

  1. MySQL索引使用方法和性能优化

    在自己的一个项目中,数据比较多,搜索也很频繁,这里找到一个建立索引很不错的文章,推荐下. 关于MySQL索引的好处,如果正确合理设计并且使用索引的MySQL是一辆兰博基尼的话,那么没有设计和使用索引的 ...

  2. 利用sqlmap和burpsuite绕过csrf token进行SQL注入 (转)

    问题:post方式的注入验证时遇到了csrf token的阻止,原因是csrf是一次性的,失效导致无法测试. 解决方案:Sqlmap配合burpsuite,以下为详细过程,参照国外牛人的blog(不过 ...

  3. Cocos2dx 小技巧(十一) 小人虽短,但能够旋转

    转眼五一就到了,放假三天应该做些什么呢?窝在家里钻研技术?写博客?no no no no,这样的"伤害"自己的方式实在让我无法忍受.本来和大学那伙人越好了一起去哪里玩玩,喝酒聊天啥 ...

  4. 7 种流行 PHP IDE 的比较

    编写关于 PHP 的系列文章让我更加深刻地了解了 PHP 开发人员的世界.我和许多 PHP 程序员交谈过,最令我惊奇的是只有很少的人使用 IDE.大多数程序员使用文本编辑器,比如 Microsoft® ...

  5. android122 zhihuibeijing 新闻中心NewsCenterPager加载网络数据实现

    新闻中心NewsCenterPager.java package com.itheima.zhbj52.base.impl; import java.util.ArrayList; import an ...

  6. linux中的工具

    远程连接linux的工具: 命令行: SecureCRT   putty  XShell(商业环境付费) 图形界面:WinSCP SecureFX 远程连接window服务器工具: FileZilla ...

  7. C# 之 用NPOI类库操作Excel

    1.需引用以下命名空间: using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.HPSF; using NPOI.HSSF.Ut ...

  8. JS类型(1)_JS学习笔记(2016.10.02)

    js类型 js中的数据类型有undefined,boolean,number,string,null,object等6种,前5种为原始类型(基本类型),基本类型的访问是按值访问的,就是说你可以操作保存 ...

  9. swift 如何使用OC中宏的功能

    swift中没有宏的概念,那么我们在swift使用宏的功能来提高效率呢? 一.使用关键字 let 来声明一个常量 存储相应的值,以下代码声明了常量  myColor 来存储一种指定的颜色 let my ...

  10. Centos 7中 vim 中文乱码

    参考:http://www.myexception.cn/operating-system/1534005.html 一. sudo vim /etc/vimrc 在文件中加入如下几行:      s ...