/// <summary>
        /// Adds a Payload to an existing package
        /// </summary>
        /// <param name="packageToAddTo">package to add the payload to</param>
        /// <param name="file">full path to the file to be added</param>
        /// <param name="newFileName">new filename, null if you don't want it renamed</param>
        /// <param name="url">Url for the file if it is to be downloaded at install time</param>
        /// <param name="includeInLayout">true of the file should be included in an attached container or as external file, false if it should not exist.</param>
        public void AddSubFile(WixTest.Burn.OM.WixAuthoringOM.Bundle.Chain.Package packageToAddTo, string file, string newFileName, string url, bool includeInLayout)
        {
            WixTest.Burn.OM.WixAuthoringOM.Bundle.PayloadElement payload = new OM.WixAuthoringOM.Bundle.PayloadElement();

            payload.SourceFile = file;
            payload.SourceFilePathT = file;
            payload.Name = System.IO.Path.GetFileName(file);
            if (!String.IsNullOrEmpty(newFileName))
            {
                payload.Name = newFileName;
            }
            if (!String.IsNullOrEmpty(url) && !includeInLayout) // BUGBUG: if a URL is provided, WiX will not put the file in the attached container.
            {
                payload.DownloadUrl = url;
            }

            packageToAddTo.Payloads.Add(payload);

            CopyPayloadToLayout(file, newFileName, true);
        }
示例#2
0
        public void AddMsiAndExternalFiles(string msiFile, string newMsiFileName, string url, bool includeInLayout, List <ExternalFile> extFiles)
        {
            OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement msi = new OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement();
            msi.Name = Path.GetFileName(msiFile);
            if (!String.IsNullOrEmpty(newMsiFileName))
            {
                msi.Name = newMsiFileName;
            }
            msi.SourceFilePathT = msiFile;
            msi.Id         = "Id_" + msi.Name;
            msi.Vital      = "no";
            msi.Cache      = "yes";
            msi.CacheId    = msi.Id;
            msi.SourceFile = msi.Name;
            if (!includeInLayout)
            {
                msi.DownloadUrl = url;
                // explicitly author Payloads for each of the external files with the specified URL for each file.
                // You don't have to do this explicitly if everything is in an attached container.  You only have to do this when you need to specify each URL.
                foreach (ExternalFile file in extFiles)
                {
                    OM.WixAuthoringOM.Bundle.PayloadElement payloadElement = new OM.WixAuthoringOM.Bundle.PayloadElement();
                    payloadElement.SourceFilePathT = file.File;
                    payloadElement.Name            = Path.GetFileName(file.File);
                    payloadElement.SourceFile      = payloadElement.Name;
                    payloadElement.DownloadUrl     = file.Url;
                    msi.Payloads.Add(payloadElement);
                }
            }
            Wix.Bundle.Chain.Packages.Add(msi);

            // copy all the files to the layout directory so the bundle will build
            // copy the MSI file
            CopyPayloadToLayout(msiFile, newMsiFileName, true);
            // copy the external files (i.e. external CABs)
            foreach (ExternalFile file in extFiles)
            {
                CopyPayloadToLayout(file.File, null, true);
            }
        }
示例#3
0
        /// <summary>
        /// Adds a Payload to an existing package
        /// </summary>
        /// <param name="packageToAddTo">package to add the payload to</param>
        /// <param name="file">full path to the file to be added</param>
        /// <param name="newFileName">new filename, null if you don't want it renamed</param>
        /// <param name="url">Url for the file if it is to be downloaded at install time</param>
        /// <param name="includeInLayout">true of the file should be included in an attached container or as external file, false if it should not exist.</param>
        public void AddSubFile(WixTest.Burn.OM.WixAuthoringOM.Bundle.Chain.Package packageToAddTo, string file, string newFileName, string url, bool includeInLayout)
        {
            WixTest.Burn.OM.WixAuthoringOM.Bundle.PayloadElement payload = new OM.WixAuthoringOM.Bundle.PayloadElement();

            payload.SourceFile = file;
            payload.SourceFilePathT = file;
            payload.Name = System.IO.Path.GetFileName(file);
            if (!String.IsNullOrEmpty(newFileName))
            {
                payload.Name = newFileName;
            }
            if (!String.IsNullOrEmpty(url) && !includeInLayout) // BUGBUG: if a URL is provided, WiX will not put the file in the attached container.
            {
                payload.DownloadUrl = url;
            }

            packageToAddTo.Payloads.Add(payload);

            CopyPayloadToLayout(file, newFileName, true);
        }
示例#4
0
        public void AddMsiAndExternalFiles(string msiFile, string newMsiFileName, string url, bool includeInLayout, List<ExternalFile> extFiles)
        {
            OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement msi = new OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement();
            msi.Name = Path.GetFileName(msiFile);
            if (!String.IsNullOrEmpty(newMsiFileName)) msi.Name = newMsiFileName;
            msi.SourceFilePathT = msiFile;
            msi.Id = "Id_" + msi.Name;
            msi.Vital = "no";
            msi.Cache = "yes";
            msi.CacheId = msi.Id;
            msi.SourceFile = msi.Name;
            if (!includeInLayout)
            {
                msi.DownloadUrl = url;
                // explicitly author Payloads for each of the external files with the specified URL for each file.
                // You don't have to do this explicitly if everything is in an attached container.  You only have to do this when you need to specify each URL.
                foreach (ExternalFile file in extFiles)
                {
                    OM.WixAuthoringOM.Bundle.PayloadElement payloadElement = new OM.WixAuthoringOM.Bundle.PayloadElement();
                    payloadElement.SourceFilePathT = file.File;
                    payloadElement.Name = Path.GetFileName(file.File);
                    payloadElement.SourceFile = payloadElement.Name;
                    payloadElement.DownloadUrl = file.Url;
                    msi.Payloads.Add(payloadElement);
                }
            }
            Wix.Bundle.Chain.Packages.Add(msi);

            // copy all the files to the layout directory so the bundle will build
            // copy the MSI file
            CopyPayloadToLayout(msiFile, newMsiFileName, true);
            // copy the external files (i.e. external CABs)
            foreach (ExternalFile file in extFiles)
            {
                CopyPayloadToLayout(file.File, null, true);
            }
        }