diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:36:37 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:36:37 -0700 |
| commit | 3f583916719eeef598d10a5d4e14ef14f008243b (patch) | |
| tree | 3d528e0ddb5c0550954217c97059d2f19cd6152a /src/samples/Dtf/Documents/Guide/Content/packages.htm | |
| parent | 2e5ab696b8b4666d551b2a0532b95fb7fe6dbe03 (diff) | |
| download | wix-3f583916719eeef598d10a5d4e14ef14f008243b.tar.gz wix-3f583916719eeef598d10a5d4e14ef14f008243b.tar.bz2 wix-3f583916719eeef598d10a5d4e14ef14f008243b.zip | |
Merge Dtf
Diffstat (limited to 'src/samples/Dtf/Documents/Guide/Content/packages.htm')
| -rw-r--r-- | src/samples/Dtf/Documents/Guide/Content/packages.htm | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/samples/Dtf/Documents/Guide/Content/packages.htm b/src/samples/Dtf/Documents/Guide/Content/packages.htm new file mode 100644 index 00000000..aa521685 --- /dev/null +++ b/src/samples/Dtf/Documents/Guide/Content/packages.htm | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
| 2 | <head> | ||
| 3 | <title>Working with Install Packages</title> | ||
| 4 | <link rel="stylesheet" type="text/css" href="../styles/presentation.css" /> | ||
| 5 | <link rel="stylesheet" type="text/css" href="ms-help://Hx/HxRuntime/HxLink.css" /> | ||
| 6 | </head> | ||
| 7 | |||
| 8 | <body> | ||
| 9 | |||
| 10 | <div id="control"> | ||
| 11 | <span class="productTitle">Deployment Tools Foundation</span><br /> | ||
| 12 | <span class="topicTitle">Working with Install Packages</span><br /> | ||
| 13 | <div id="toolbar"> | ||
| 14 | <span id="chickenFeet"> | ||
| 15 | <a href="using.htm">Development Guide</a> > | ||
| 16 | <span class="nolink">Install Packages</span> | ||
| 17 | </span> | ||
| 18 | </div> | ||
| 19 | </div> | ||
| 20 | <div id="main"> | ||
| 21 | <div id="header"> | ||
| 22 | </div> | ||
| 23 | <div class="summary"> | ||
| 24 | |||
| 25 | <h3>Updating files in a product layout</h3> | ||
| 26 | <p>The InstallPackage class makes it easy to work with files and cabinets | ||
| 27 | in the context of a compressed or uncompressed product layout.</p> | ||
| 28 | <p>This hypothetical example takes an IDictionary 'files' which maps file keys to file paths. Each | ||
| 29 | file is to be updated in the package layout; cabinets are even recompressed if necessary to include the new files.</p> | ||
| 30 | <pre><font face="Consolas, Courier New"> <font color=blue>using</font> (InstallPackage pkg = <font color=blue>new</font> InstallPackage(<font color=purple>"d:\builds\product.msi"</font>, | ||
| 31 | DatabaseOpenMode.Transact)) | ||
| 32 | { | ||
| 33 | pkg.WorkingDirectory = Path.Combine(Path.GetTempFolder(), <font color=purple>"pkgtmp"</font>); | ||
| 34 | <font color=blue>foreach</font> (string fileKey in files.Keys) | ||
| 35 | { | ||
| 36 | <font color=blue>string</font> sourceFilePath = files[fileKey]; | ||
| 37 | <font color=blue>string</font> destFilePath = pkg.Files[fileKey].SourcePath; | ||
| 38 | destFilePath = Path.Combine(pkg.WorkingDirectory, destFilePath); | ||
| 39 | File.Copy(sourceFilePath, destFilePath, <font color=blue>true</font>); | ||
| 40 | } | ||
| 41 | pkg.UpdateFiles(<font color=blue>new</font> ArrayList(files.Keys)); | ||
| 42 | pkg.Commit(); | ||
| 43 | Directory.Delete(pkg.WorkingDirectory, <font color=blue>true</font>); | ||
| 44 | }</font></pre><br /> | ||
| 45 | <p>1. Create a <a href="DTFAPI.chm::/html/Overload_Microsoft_Deployment_WindowsInstaller_Package_InstallPackage__ctor.htm">new InstallPackage</a> | ||
| 46 | instance referring to the location of the .msi. This is actually just a specialized subclass of a Database.</p> | ||
| 47 | <p>2. Set the <a href="DTFAPI.chm::/html/P_Microsoft_Deployment_WindowsInstaller_Package_InstallPackage_WorkingDirectory.htm">WorkingDirectory</a>. | ||
| 48 | This is the root directory where the package expects to find the new source files.</p> | ||
| 49 | <p>3. Copy each file to its proper location in the working directory. The | ||
| 50 | <a href="DTFAPI.chm::/html/P_Microsoft_Deployment_WindowsInstaller_Package_InstallPackage_Files.htm">InstallPackage.Files</a> | ||
| 51 | property is used to look up the relative source path of each file.</p> | ||
| 52 | <p>4. Call <a href="DTFAPI.chm::/html/Overload_Microsoft_Deployment_WindowsInstaller_Package_InstallPackage_UpdateFiles.htm">InstallPackage.UpdateFiles</a> | ||
| 53 | with the list of file keys. This will re-compress and package the files if necessary, and also update the | ||
| 54 | following data: File.FileSize, File.Version, File.Language, MsiFileHash.HashPart*.</p> | ||
| 55 | <p>5. Commit the database changes and cleanup the working directory.</p> | ||
| 56 | </ul> | ||
| 57 | |||
| 58 | <p><br/></p> | ||
| 59 | <p><b>See also:</b></p> | ||
| 60 | <ul> | ||
| 61 | <li><a href="wifile.htm">WiFile Sample Tool</a> - a more complete tool that expands on the above example.</li> | ||
| 62 | <li><a href="DTFAPI.chm::/html/T_Microsoft_Deployment_WindowsInstaller_Package_InstallPackage.htm">InstallPackage Class</a></li> | ||
| 63 | </ul> | ||
| 64 | <p><br/></p> | ||
| 65 | |||
| 66 | </div> | ||
| 67 | |||
| 68 | <div id="footer"> | ||
| 69 | <p /> | ||
| 70 | Send comments on this topic to <a id="HT_MailLink" href="mailto:wix-users%40lists.sourceforge.net?Subject=Deployment Tools Foundation Documentation"> | ||
| 71 | wix-users@lists.sourceforge.net</a> | ||
| 72 | |||
| 73 | <script type="text/javascript"> | ||
| 74 | var HT_mailLink = document.getElementById("HT_MailLink"); | ||
| 75 | var HT_mailLinkText = HT_mailLink.innerHTML; | ||
| 76 | HT_mailLink.href += ": " + document.title; | ||
| 77 | HT_mailLink.innerHTML = HT_mailLinkText; | ||
| 78 | </script> | ||
| 79 | |||
| 80 | <p /> | ||
| 81 | |||
| 82 | </div> | ||
| 83 | </div> | ||
| 84 | |||
| 85 | </body> | ||
| 86 | </html> | ||
