Welcome to MSDN Blogs Sign in | Join | Help

WiX: Patching something you didnt build with WiX using WiX

Many times people want to take advantage of the Wix v3 patch building features but didnt build their original product using Wix. for example, they may have used Install Shield, WiX v2 or one of the other tools out there. I ran into this when I needed to create a patch for a product we shipped from Visual Studio before the Visual Studio build moved to WiX v3.

 WiX v3 has a feature I added a while back to support this scenario. It allows you to point at an admin image of your msi based install package. This will be very familiar to some of you who have used patchwiz and pcp's in the past. The difference here is that your patch authoring can be done using the WiX v3 Patch element and it follows the same workflow as patching a WiX v3 based msi after the first stage of creating the diffs.

Something I found really easy, and I could see this being used by smaller products who dont have a lot of infrastructure, is the ability to hand edit your admin image to product the patch. For example, I wanted to update a single file in my product:

1. I created an admin image
2. I made a copy of the admin image
3. I updated the loose file in my copy of the admin image

After running it through the series of command lines, I got a patch that updated the file. Pretty simple...

The command lines you need to run are all the same as the ones in my sample: Building a Patch using the new Patch Building System - Part 3. The only difference is that you need to pass the -ax command with a path to extract embedded binaries to instead of the -xi switch. This tells torch that the input is admin image instead of xml. Also, specify the path to the msi in the admin images instead of the wixpdb as the target and upgrade. Everything after that should follow the same process.

Let me know how it works! :)

Bonus feature: One of the most useful things in the WiX v3 patching system is the ability to filter whats in your patch using patch families to only ship your customers the updates they need. This allows you to grab changes per Fragment from your wix source. When patching from admin images, there is no source so you would think that the filtering isn't suppoted. Not so! This was one of the more fun parts of this implementation. We "auto-fragment" the msi into what we consider to be the optimal chunks to give you the ability to filter if you choose to do so.

Published Friday, May 30, 2008 4:05 PM by Petermarcu

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Doctor Deploys Blog :: WiX: Patching something you didnt build with WiX using WiX

# re: WiX: Patching something you didnt build with WiX using WiX

With WiX build 4415 I get:

torch.exe : error TRCH0001 : The Windows Installer service failed to start. Contact your support personnel

Exception Type: System.ComponentModel.Win32Exception

Stack Trace:

  at Microsoft.Tools.WindowsInstallerXml.Msi.Database.GenerateTransform(Databas

e referenceDatabase, String transformFile)

  at Microsoft.Tools.WindowsInstallerXml.Binder.BindTransform(Output transform,

String transformFile)

  at Microsoft.Tools.WindowsInstallerXml.Binder.Bind(Output output, String file

)

  at Microsoft.Tools.WindowsInstallerXml.Tools.Torch.Run(String[] args)

Binder temporary directory located at 'C:\Users\me\AppData\Local\Temp\bhbh

zyew'.

Unbinder temporary directory located at 'C:\Users\me\AppData\Local\Temp\bh

bhzyew'.

Torch temporary directory located at 'C:\Users\me\AppData\Local\Temp\kd0mm

uii'.

Tuesday, September 02, 2008 1:10 PM by Tony Juricic

# re: WiX: Patching something you didnt build with WiX using WiX

Can you provide more info? The command lines you ran. Possibly the msi's for the target and upgrade?

Tuesday, September 02, 2008 1:17 PM by Petermarcu

# re: WiX: Patching something you didnt build with WiX using WiX

That scary message went away when I created  Patch folder instead of expecting torch to create it.

Command line was:

"%WIX%bin\torch.exe" -p -a -v -val g -val l -val r -val z Build81\admin\Product.msi Build82\admin\Product.msi -out Patch\Diff.Wixmst

However now Pyro is not happy and gives me:

C:\newwixpatch\Patch\Diff.wixmst : error PYRO0104 : Not a valid output file; det

ail: Invalid character in the given encoding. Line 1, position 1.

Command line for Pyro is (build patch as well):

"%WIX%bin\candle.exe" Patch.wxs

"%WIX%bin\light.exe" Patch.wixobj -out Patch\Patch.WixMsp

REM "%WIX%bin\pyro.exe" -delta Patch\Patch.WixMsp -out Patch\Patch.msp -t RTM Patch\Diff.wixmst

"%WIX%bin\pyro.exe" Patch\Patch.WixMsp -out Patch\Patch.msp -t RTM Patch\Diff.wixmst

These commands are actually batch files located in my test folder  c:\newwixpatch

Tuesday, September 02, 2008 1:29 PM by Tony Juricic

# re: WiX: Patching something you didnt build with WiX using WiX

Nothing is standing out to me. I dont see anything wrong with what you are doing. I'd likely need more data. Can you file 2 sourceforge bugs? One for the fact that Torch is giving a bad error if a directory does not exist and another one about the latest error. Please attach varios files such as the Diff.wixmst so we can see why its considered an invalid output file. Also, what version of Wix are you using?

Monday, September 08, 2008 12:15 PM by Petermarcu

# re: WiX: Patching something you didnt build with WiX using WiX

Will do! WiX version is 3.0.4415.0. Thanks.

Wednesday, September 10, 2008 3:24 PM by Tony Juricic

# re: WiX: Patching something you didnt build with WiX using WiX

It seems you need to provide -xo also when doing a diff on msi files. That makes the output format to be of wixout format which is implicitly done when using -xi.

At least that solved the same problem for me.

Thursday, November 20, 2008 6:55 AM by Nils Wendelöv

# re: WiX: Patching something you didnt build with WiX using WiX

Can you please list a "step by step" instruction on how you do this. I have followed your instructions and can only get a diff.wixmst to be produced, I cannot get patch.wxs etc..

This is do-able:

torch.exe -p -xo -ax C:\Embeded 1.0\product.wixpdb 1.1\product.wixpdb -out patch\diff.wixmst

But how can you execute the next lines when you dont have the product.wxs files?

candle.exe patch.wxs

light.exe patch.wixobj -out patch\patch.wixmsp

pyro.exe patch\patch.wixmsp -out patch\patch.msp -t RTM patch\diff.wixmst

Sunday, November 23, 2008 5:47 PM by Kadir

# Your instructions don't match your example.

Your instructions don't match your example. You say;

"The difference here is that your patch authoring can be done using the WiX v3 Patch element and it follows the same workflow as patching a WiX v3 based msi after the first stage of creating the diffs."

Acording to your example referenced the first stage does not make the diffs it makes the .wxs.

1. Build Target Layout:

> candle.exe -dVersion=1.0 product.wxs

> light.exe -sval Product.wixobj -out 1.0\Product.msi

Another issue is you say;

"The command lines you need to run are all the same as the ones in my sample: Building a Patch using the new Patch Building System - Part 3. The only difference is that you need to pass the -ax command with a path to extract embedded binaries to instead of the -xi switch."

Below are the rest of your command lines and the only one that works is 3. Transform (torch.exe)

If you follow your instructions you get a diff.wixmst and that's it. None of your instructions explain how to do the next step after creating your diff file, which is 4. Building the Patch (candle.exe, light.exe,pyro.exe)

If we had better instructions we could do the last step of 4. which is pyro.exe

Can you please provide step by step instructions and assume you are talking to idiots because we don't know what you know :)

2. Build the Upgrade Layout:

> candle.exe -dVersion=1.1 product.wxs

> light.exe -sval Product.wixobj -out 1.1\Product.msi

3. Create the transform between your products:

> torch.exe -p -xi 1.0\Product.wixpdb 1.1\Product.wixpdb -out Patch\Diff.Wixmst

4. Build the Patch:

> candle.exe Patch.wxs

> light.exe Patch.wixobj -out Patch\Patch.WixMsp

> pyro.exe Patch\Patch.WixMsp -out Patch\Patch.msp -t RTM Patch\Diff.wixmst

Sunday, November 23, 2008 6:59 PM by kadir

# re: WiX: Patching something you didnt build with WiX using WiX

You have to create the patch.wxs file. It is a source file and is not automatically generated for you. You can use the one from my sample on how to build a patch using pyro.

Sunday, November 23, 2008 9:55 PM by Petermarcu

# re: WiX: Patching something you didnt build with WiX using WiX

hello, after some troubles regarding to use torch on MSI I have finally made a sample msp. I only wondered what does the

ComponentRef tag beyond <PatchFamily> element  in patch.wxs?

When entering a reference there, the patch file is really small instead when leaving it blank (none ref tags)???

Friday, May 15, 2009 9:48 AM by quirrel

# re: WiX: Patching something you didnt build with WiX using WiX

The ComponentRef means that only that component will be included in the patch. If you leave your patch family empty, it defaults to including all the differences.

Monday, June 22, 2009 1:09 PM by Petermarcu

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker