Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add an MSI to the Chain of payloads this bundle will install
        /// </summary>
        /// <param name="file">full path to the MSI file to add</param>
        /// <param name="newFileName">New filename for the MSI, null if you don't want to rename it</param>
        /// <param name="url">URL where the MSI can be downloaded from, null if you don't want to download it</param>
        /// <param name="includeInLayout">true if the MSI should be included in the bundle or as an external file, false if it should not exist.</param>
        /// <param name="msiPropertyName">name of a property to be sent to the MSI at install time</param>
        /// <param name="msiPropertyValue">value of the named property to be sent to the MSI at install time</param>
        /// <param name="installCondition">condition that this MSI will be installed</param>
        /// <param name="rollbackInstallCondition">UNUSED (BUGBUG, rip this out)</param>
        public void AddMsi(string file, string newFileName, string url, bool includeInLayout, string msiPropertyName, string msiPropertyValue
                           , string installCondition, string rollbackInstallCondition)
        {
            OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement msi = new OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement();
            msi.SourceFilePathT = file;
            msi.Name            = Path.GetFileName(file);
            if (!String.IsNullOrEmpty(newFileName))
            {
                msi.Name = newFileName;
            }
            msi.Id         = "Id_" + msi.Name;
            msi.Vital      = "no";
            msi.Cache      = "yes";
            msi.CacheId    = msi.Id;
            msi.SourceFile = msi.Name;
            // if you include a URL, the item will be downloaded.
            if (!includeInLayout)
            {
                msi.DownloadUrl = url;
            }

            if (!string.IsNullOrEmpty(msiPropertyName) && !string.IsNullOrEmpty(msiPropertyValue))
            {
                OM.WixAuthoringOM.Bundle.Chain.MsiPropertyElement msiProperty = new OM.WixAuthoringOM.Bundle.Chain.MsiPropertyElement();
                msiProperty.Name  = msiPropertyName;
                msiProperty.Value = msiPropertyValue;

                msi.MsiProperty = msiProperty;
            }

            if (!string.IsNullOrEmpty(installCondition))
            {
                msi.InstallCondition = installCondition;
            }

            Wix.Bundle.Chain.Packages.Add(msi);

            CopyPayloadToLayout(file, newFileName, true);
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Add an MSI to the Chain of payloads this bundle will install
        /// </summary>
        /// <param name="file">full path to the MSI file to add</param>
        /// <param name="newFileName">New filename for the MSI, null if you don't want to rename it</param>
        /// <param name="url">URL where the MSI can be downloaded from, null if you don't want to download it</param>
        /// <param name="includeInLayout">true if the MSI should be included in the bundle or as an external file, false if it should not exist.</param>
        /// <param name="msiPropertyName">name of a property to be sent to the MSI at install time</param>
        /// <param name="msiPropertyValue">value of the named property to be sent to the MSI at install time</param>
        /// <param name="installCondition">condition that this MSI will be installed</param>
        /// <param name="rollbackInstallCondition">UNUSED (BUGBUG, rip this out)</param>
        public void AddMsi(string file, string newFileName, string url, bool includeInLayout, string msiPropertyName, string msiPropertyValue
            , string installCondition, string rollbackInstallCondition)
        {
            OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement msi = new OM.WixAuthoringOM.Bundle.Chain.MsiPackageElement();
            msi.SourceFilePathT = file;
            msi.Name = Path.GetFileName(file);
            if (!String.IsNullOrEmpty(newFileName))
            {
                msi.Name = newFileName;
            }
            msi.Id = "Id_" + msi.Name;
            msi.Vital = "no";
            msi.Cache = "yes";
            msi.CacheId = msi.Id;
            msi.SourceFile = msi.Name;
            // if you include a URL, the item will be downloaded.
            if (!includeInLayout) msi.DownloadUrl = url;

            if (!string.IsNullOrEmpty(msiPropertyName) && !string.IsNullOrEmpty(msiPropertyValue))
            {
                OM.WixAuthoringOM.Bundle.Chain.MsiPropertyElement msiProperty = new OM.WixAuthoringOM.Bundle.Chain.MsiPropertyElement();
                msiProperty.Name = msiPropertyName;
                msiProperty.Value = msiPropertyValue;

                msi.MsiProperty = msiProperty;
            }

            if (!string.IsNullOrEmpty(installCondition))
            {
                msi.InstallCondition = installCondition;
            }

            Wix.Bundle.Chain.Packages.Add(msi);

            CopyPayloadToLayout(file, newFileName, true);
        }