Beispiel #1
0
        /// <summary>
        /// Build a patch from two admin images
        /// </summary>
        /// <param name="workingDirectory">WiX working directory</param>
        /// <param name="targetMsi">Target admin image</param>
        /// <param name="upgradeMsi">Upgrade admin image</param>
        /// <param name="patchSource">Patch source file</param>
        /// <param name="patchFileName">Name of output file</param>
        /// <param name="baseline">Id of the baseline layout</param>
        public static void BuildPatchFromAdminImages(string workingDirectory, string targetMsi, string upgradeMsi, string patchSource, string patchFileName, string baseline)
        {
            string outputDirectory = Environment.CurrentDirectory;

            // Create directories for intermediate output
            FileUtilities.CreateOutputDirectory(Path.Combine(outputDirectory, Settings.WixobjFolder));
            FileUtilities.CreateOutputDirectory(Path.Combine(outputDirectory, Settings.WixoutFolder));
            FileUtilities.CreateOutputDirectory(Path.Combine(outputDirectory, Settings.MstFolder));
            FileUtilities.CreateOutputDirectory(Path.Combine(outputDirectory, Settings.MspFolder));

            // Build Transforms
            // string transformWixMST = Path.Combine(Settings.WixoutFolder, "transform.wixmst");
            string transformWixMST = "transform.wixmst";

            Builder.BuildTransform(workingDirectory, targetMsi, upgradeMsi, false, transformWixMST, true, "-a");

            // string transformMST = Path.Combine(Settings.MSTFolder, "transform.mst");
            string transformMST = "transform.mst";

            Builder.BuildTransform(workingDirectory, targetMsi, upgradeMsi, false, transformMST, false, "-a");

            // Build Patch
            string patchWixMSP = Path.Combine(Settings.WixoutFolder, "patch.wixmsp");

            Builder.BuildPackage(workingDirectory, patchSource, patchWixMSP, null, "-xo");

            Pyro pyro = new Pyro();

            pyro.WorkingDirectory = workingDirectory;
            pyro.InputFile        = patchWixMSP;
            pyro.OutputFile       = patchFileName;
            pyro.Baselines.Add(transformWixMST, baseline);
            pyro.ExpectedWixMessages.Add(new WixMessage(1079, WixMessage.MessageTypeEnum.Warning));
            pyro.Run();
        }
Beispiel #2
0
        /// <summary>
        /// Build a patch
        /// </summary>
        /// <param name="workingDirectory">WiX working directory</param>
        /// <param name="targetSources">Target source files</param>
        /// <param name="upgradeSources">Upgrade source files</param>
        /// <param name="patchSources">Patch source file</param>
        /// <param name="patchFileName">Name of output file</param>
        /// <param name="baseline">The name of the baseline</param>
        /// <param name="patchCompilerExtension">A Wix extension to pass when compiling the patch</param>
        public static void BuildPatch(string workingDirectory, string[] targetSources, string[] upgradeSources, string[] patchSources, string patchFileName, string baseline, string patchCompilerExtension)
        {
            string outputDirectory = Environment.CurrentDirectory;

            // Create directories for intermediate output
            string wixobjDirectory = Path.Combine(outputDirectory, Settings.WixobjFolder);
            FileUtilities.CreateOutputDirectory(wixobjDirectory);
            string wixoutDirectory = Path.Combine(outputDirectory, Settings.WixoutFolder);
            FileUtilities.CreateOutputDirectory(wixoutDirectory);
            string msiDirectory = Path.Combine(outputDirectory, Settings.MsiFolder);
            FileUtilities.CreateOutputDirectory(msiDirectory);
            string mstDirectory = Path.Combine(outputDirectory, Settings.MstFolder);
            FileUtilities.CreateOutputDirectory(mstDirectory);
            string mspDirectory = Path.Combine(outputDirectory, Settings.MspFolder);
            FileUtilities.CreateOutputDirectory(mspDirectory);

            // Build Target .wixout
            string targetWixout = Path.Combine(wixoutDirectory, "target.wixout");
            string targetMSI = Path.Combine(msiDirectory, @"target\target.msi");
            Builder.BuildPackage(workingDirectory, targetSources, targetWixout, null, "-xo");
            Builder.BuildPackage(workingDirectory, targetSources, targetMSI, null, null);

            // Build Upgrade .wixout
            string upgradeWixout = Path.Combine(wixoutDirectory, "upgrade.wixout");
            string upgradeMSI = Path.Combine(msiDirectory, @"upgrade\upgrade.msi");
            Builder.BuildPackage(workingDirectory, upgradeSources, upgradeWixout, null, "-xo");
            Builder.BuildPackage(workingDirectory, upgradeSources, upgradeMSI, null, null);

            // Build Transform
            string transformWixMST = Path.Combine(wixoutDirectory, "transform.wixmst");
            Builder.BuildTransform(workingDirectory, targetWixout, upgradeWixout, true, transformWixMST, true);

            // Build a transform database from diffing the msis
            string transformMST = Path.Combine(mstDirectory, "transform.mst");
            Builder.BuildTransform(workingDirectory, targetMSI, upgradeMSI, false, transformMST, false);

            string patchWixMSP = Path.Combine(wixoutDirectory, "patch.wixmsp");
            if (!String.IsNullOrEmpty(patchCompilerExtension))
            {
                string extensionArgument = String.Format(@"-ext ""{0}""", patchCompilerExtension);
                Builder.BuildPackage(workingDirectory, patchSources, patchWixMSP, extensionArgument, "-xo");
            }
            else
            {
                Builder.BuildPackage(workingDirectory, patchSources, patchWixMSP, null, "-xo");
            }

            Pyro pyro = new Pyro();
            pyro.WorkingDirectory = workingDirectory;
            pyro.InputFile = patchWixMSP;
            pyro.OutputFile = patchFileName;
            pyro.Baselines.Add(transformWixMST, baseline);
            pyro.ExpectedWixMessages.Add(new WixMessage(1079, WixMessage.MessageTypeEnum.Warning));
            pyro.Run();
        }
Beispiel #3
0
 /// <summary>
 /// Builds a transform from two setup packages
 /// </summary>
 /// <param name="workingDirectory">WiX working directory</param>
 /// <param name="target">The target file</param>
 /// <param name="update">The updated file</param>
 /// <param name="inputXML">If true, the inputs to Torch are XML</param>
 /// <param name="transform">The name of the transform</param>
 /// <param name="outputXML">If true, create an MST in wixout format</param>
 public static void BuildTransform(string workingDirectory, string target, string update, bool inputXML, string transform, bool outputXML)
 {
     Builder.BuildTransform(workingDirectory, target, update, inputXML, transform, outputXML, null);
 }