0
votes

I have an issue when creating a patch, using pyro tool. I am not sure if this is a WiX tool defect, or I am doing something wrong. When executing the pyro.exe, my release builder crashes with the output from the pyro tool as below:


Windows Installer XML Toolset Patch Builder version 3.11.0.1701 Copyright (c) .NET Foundation and contributors. All rights reserved.

pyro.exe : error PYRO0001 : Object reference not set to an instance of an object.

Exception Type: System.NullReferenceException

Stack Trace: at Microsoft.Tools.WindowsInstallerXml.MediaRow.get_LastSequence() at Microsoft.Tools.WindowsInstallerXml.Patch.AttachTransforms(ArrayList transforms) at Microsoft.Tools.WindowsInstallerXml.Tools.Pyro.Run(String[] args)


And, this is the execution sequence of WiX tools I am using to build a patch:

  1. candle.exe -out Patch.wixobj -ext WixUIExtension -ext WixNetFxExtension -arch x86
  2. light.exe -out Product_1.wixout Product_1.wixobj -xo -ext WixUIExtension -ext WixNetFxExtension
  3. light.exe -out Product_2.wixout Product_2.wixobj -xo -ext WixUIExtension -ext WixNetFxExtension
  4. torch.exe -out Diff.wixmst Product_wixout Product_2.wixout -p -xi -ext WixUIExtension -ext WixNetFxExtension
  5. light.exe -out Patch.wixmsp Patch.wixobj -ext WixUIExtension -ext WixNetFxExtension
  6. pyro.exe -outPatch.msp Patch.wixmsp -t MyPatch Diff.wixmst

Please advise.

Many thanks

1

1 Answers

2
votes

The current workaround for this issue (that is not documented, for whatever terrible reason), is to change the way media is defined in your product you are creating a patch for.

So, instead of using the following in your Product element (which is the recommended approach...):

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product ...>
     ...
     <MediaTemplate EmbedCab="yes" />
     ...
  </Product>
</Wix>

You will need to replace the MediaTemplate element with the Media element, like the following:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product ...>
     ...
     <Media Id="1" Cabinet="MyProduct.cab" EmbedCab="yes" />
     ...
  </Product>
</Wix>

For more advanced installations, the Media element will be more difficult to use than MediaTemplate, but there is decent documentation on these elements out there. What I've shown is for the simplest type of install. I think this issue cropped up when the WiX Toolset team introduced the newer, easier to use MediaTemplate, and somehow the patching use-case was missed in testing.

Hopefully this helps anyone else who is trying to use WiX Patching and getting this nasty exception.