Exemplo n.º 1
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.º 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);
        }