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