It's not clear to me what that ApplyPatch method is doing under the covers.
It's not MsiApplyPatch(), because that does an install of the patch. It
appears to actually be MsiDatabaseAplyTransform() judging from the
transform parameter, and that just modifies the tables.

This might help:
http://blogs.msdn.com/b/heaths/archive/2006/02/14/532200.aspx

particularly where he mentions using MsiOpenDatabase on a patch file and
then looking for streams.

Phil Wilson


On Thu, Nov 7, 2013 at 2:20 PM, Jeff Nielsen <jeffn...@me.com> wrote:

> Blair et al,
>
> Thanks for the info, but I'm still fairly well stuck. If the patch cab
> remains in the patch, it seems my code doesn't allow the
> InstallPackage.ExtractFiles method to find the patch's cab at extract time.
> This would make sense as to why I'm getting a Stream Not Found error.
>
> Is there somewhere specific I need to place the patch file, or some
> method/property I need to call to allow the ExtractFiles method to be able
> to find the patch cab? I currently have the msi, the msi's exteernal cabs
> and the msp in the same directory, which is set as the
> InstallPackage.SourceDirectory.
>
> Jeff
>
>
> Date: Thu, 7 Nov 2013 13:38:23 +0000
> From: Blair Murri <os...@live.com>
> Subject: Re: [WiX-users] Deployment Tools Foundation: ApplyPatch
>         Method
> To: General discussion for Windows Installer XML toolset.
>         <wix-users@lists.sourceforge.net>
> Message-ID: <blu405-eas1727484a80f6343be7b6bbacd...@phx.gbl>
> Content-Type: text/plain; charset="utf-8"
>
> Applying the patch adds a row to the media table and changes the file
> table?s sequence numbers to reflect the patched files being in the patch?s
> cab. That cab will still be in the MSP file.
>
> Blair
>
>
> From: Jeff Nielsen
> Sent: ?Wednesday?, ?November? ?06?, ?2013 ?10?:?32? ?PM
> To: General discussion for Windows Installer XML toolset.
>
> I'm trying to use the DTF libraries to apply a Patch to an Msi file and
> then extract the updated files from the Patched Msi. I can't get it
> working, and I'm at wit's end. Any guidance would be much appreciated.
>
> I can apply the patch and transform to the msi, and the Files table in the
> Msi then contains the updates from the patch. That seems good. I then try
> to use InstallerPackage.ExtractFiles to extract the files into a directory.
> When I get down to a file whose contents is in the CAB in the Patch
> (netfx.msp), I receive a "Stream Not Found: netfx_PCW_CAB_NDP" error. I
> can't figure out how to get the patch cab (PCW_CAB-NDP) into the Msi. I
> thought that InstallerPackage.ApplyPatch would do this, but apparently not.
>
> I'm using netfx.msi and netfx.msp that is in the \upgrades\netfx directory
> in the Win 7 distribution for my testing. Here's a shortened version of my
> code:
>
> // define the variables
> string msiPath = @"d:\upgrade\netfx\netfx.msi";
> string mspPath = @"d:\upgrade\netfx\netfx.msp";
> string transformName = "T320_1ToU1.MST";
>
> // open the Msi file
> using (InstallPackage package = new InstallPackage(msiPath,
> DatabaseOpenMode.Transact))
> {
>        // open the Msp file
>       using (PatchPackage patch = new PatchPackage(mspPath))
>       {
>         // set the directories for the Msi file
>               package.WorkingDirectory = unpackSubdirectory;
>               package.SourceDirectory =
> System.IO.Path.GetDirectoryName(msiPath);
>
>               // apply the patch
>               package.ApplyPatch(patch, transformName);
>
>               // query the list of files from the Msi
>               List<String> fileList = new
> List<string>(package.ExecuteStringQuery("SELECT `File` FROM `File`", null));
>
>               // loop through the files in the fileList
>               foreach (String fileItem in fileList)
>               {
>                        // add the string to a FileArray
>                       string[] fileArray = { fileItem };
>
>                       // extract the files
>                       package.ExtractFiles(fileArray);
>               }
>        }
> }
>
> > From the DTF Help file, I think that
> InstallPackage.Consolidate(mediaCabinet) might be the answer, but I can't
> get that to work.
>
> Thanks,
> Jeff
>
> ------------------------------------------------------------------------------
> November Webinars for C, C++, Fortran Developers
> Accelerate application performance with scalable programming models.
> Explore
> techniques for threading, error checking, porting, and tuning. Get the most
> from the latest Intel processors and coprocessors. See abstracts and
> register
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most 
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to