I think I've figured out why InstallPackage.ApplyPath method is failing for me, and I think this is a bug in the DTF code. Phil's comments got me thinking and I've done my best to debug what's going on in ApplyPatch. I'm a newbie on several levels here, so forgive me if I've missed something.
The ApplyPatch method does two basic things: 1) applies the transform to the database and 2) copies the patch cab from the patch and inserts it into the database. Applying the transform seems to work correctly, but the problem is in moving the patch cab into the database. Before moving the cab, ApplyPatch creates a record for the patch cab in the Media table, using the string renamePatchCabinet ("netfx_PCW_CAB_NDP" in my case) string patchPrefix = Path.GetFileNameWithoutExtension(patchPackage.FilePath) + "_"; ... string renamePatchCabinet = patchPrefix + patchCabinet; ... this.Execute("INSERT INTO `Media` (`DiskId`, `LastSequence`, `Cabinet`) VALUES ({0}, '{1}', '#{2}')", renamePatchMediaDiskId, lastSeq, renamePatchCabinet); When ApplyPatch inserts the cab into the database, the cab is named with the patchCabinet string ("PCW_CAB_NDP" in my case) patchCabRec[1] = patchCabinet; patchCabRec.SetStream(2, patchCabFile); this.Execute("INSERT INTO `_Streams` (`Name`, `Data`) VALUES (?, ?)", patchCabRec); So when I call InstallPackage.ExtractFiles, I get an error message "Stream Not Found: netfx_PCW_CAB_NDP", as the stream is actually named "PCW_CAB_NDP" in the database. If I change: "patchCabRec[1] = patchCabinet;" to "patchCabRec[1] = renamePatchCabinet;", InstallPackage.ExtractFiles will extract all this files without any errors. On a related note, I'm having a challenge with InstallPackage.Commit(). If I instantiate InstallPackage with DatabaseOpenMode.Transact, when I call InstallPackage.Commit(), I get a "function failed during execution" exception with the following StackTrace: at Microsoft.Deployment.WindowsInstaller.SummaryInfo.Persist() at Microsoft.Deployment.WindowsInstaller.Database.Commit() ... If I instantiate InstallPackage with DatabaseOpenMode.Direct, at the end of my using() I also get a "function failed during execution" exception with the following StackTrace: at Microsoft.Deployment.WindowsInstaller.SummaryInfo.Persist() at Microsoft.Deployment.WindowsInstaller.Database.Commit() at Microsoft.Deployment.WindowsInstaller.Database.Dispose(Boolean disposing) at Microsoft.Deployment.WindowsInstaller.InstallerHandle.Dispose() ... Strangely, I can use instantiate Database with DatabaseOpenMode.Transact and Database.Commit() seems to work fine. (I haven't tried Database with DatabaseOpenMode.Direct) >From what I can tell in the source, InstallPackage.Commit() is inherited from >Database.Commit(), so I'm a bit perplexed. Any ideas? Regards, Jeff Date: Fri, 8 Nov 2013 10:40:15 -0800 From: Phil Wilson <phildgwil...@gmail.com> Subject: Re: [WiX-users] Deployment Tools Foundation: ApplyPatch Method To: "General discussion about the WiX toolset." <wix-users@lists.sourceforge.net> Message-ID: <caczvprztswwr-j2bee71fyyqu7w8oojoripoduswhkybdbg...@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 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 ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users