Пример #1
0
        /// <summary>
        /// Applies one or more patches to products that are eligible to receive the patch.
        /// For each product listed by the patch package as eligible to receive the patch, ApplyPatch invokes
        /// an installation and sets the PATCH property to the path of the patch package.
        /// </summary>
        /// <param name="patchPackages">The set of patch packages to be applied.
        /// Each item is the full path to an MSP file.</param>
        /// <param name="productCode">Provides the ProductCode of the product being patched. If this parameter
        /// is null, the patches are applied to all products that are eligible to receive these patches.</param>
        /// <param name="commandLine">optional command line property settings</param>
        /// <remarks><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiapplymultiplepatches.asp">MsiApplyMultiplePatches</a>
        /// </p></remarks>
        public static void ApplyMultiplePatches(
            IList <string> patchPackages, string productCode, string commandLine)
        {
            if (patchPackages == null || patchPackages.Count == 0)
            {
                throw new ArgumentNullException("patchPackages");
            }

            StringBuilder patchList = new StringBuilder();

            foreach (string patch in patchPackages)
            {
                if (patch != null)
                {
                    if (patchList.Length != 0)
                    {
                        patchList.Append(';');
                    }

                    patchList.Append(patch);
                }
            }

            if (patchList.Length == 0)
            {
                throw new ArgumentNullException("patchPackages");
            }

            uint ret = NativeMethods.MsiApplyMultiplePatches(patchList.ToString(), productCode, commandLine);

            Installer.CheckInstallResult(ret);
        }
Пример #2
0
        /// <summary>
        /// For each product listed by the patch package as eligible to receive the patch, ApplyPatch invokes
        /// an installation and sets the PATCH property to the path of the patch package.
        /// </summary>
        /// <param name="patchPackage">path to the patch package</param>
        /// <param name="installPackage">path to the product to be patched, if installType
        /// is set to <see cref="InstallType.NetworkImage"/></param>
        /// <param name="installType">type of installation to patch</param>
        /// <param name="commandLine">optional command line property settings</param>
        /// <exception cref="InstallerException">There was an error applying the patch</exception>
        /// <remarks><p>
        /// The <see cref="RebootRequired"/> and <see cref="RebootInitiated"/> properties should be
        /// tested after calling this method.
        /// </p><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiapplypatch.asp">MsiApplyPatch</a>
        /// </p></remarks>
        public static void ApplyPatch(string patchPackage, string installPackage, InstallType installType, string commandLine)
        {
            uint ret = NativeMethods.MsiApplyPatch(patchPackage, installPackage, (int)installType, commandLine);

            Installer.CheckInstallResult(ret);
        }
Пример #3
0
        /// <summary>
        /// Installs or uninstalls a product.
        /// </summary>
        /// <param name="productCode">Product code of the product to be configured.</param>
        /// <param name="installLevel">Specifies the default installation configuration of the
        /// product. The <paramref name="installLevel"/> parameter is ignored and all features
        /// are installed if the <paramref name="installState"/> parameter is set to any other
        /// value than <see cref="InstallState.Default"/>. This parameter must be either 0
        /// (install using authored feature levels), 65535 (install all features), or a value
        /// between 0 and 65535 to install a subset of available features.																																											   </param>
        /// <param name="installState">Specifies the installation state for the product.</param>
        /// <param name="commandLine">Specifies the command line property settings. This should
        /// be a list of the format Property=Setting Property=Setting.</param>
        /// <exception cref="InstallerException">There was an error configuring the product</exception>
        /// <remarks><p>
        /// This method displays the user interface with the current settings and
        /// log mode. You can change user interface settings with the <see cref="SetInternalUI(InstallUIOptions)"/>
        /// and <see cref="SetExternalUI(ExternalUIHandler,InstallLogModes)"/> functions. You can set the log mode with the
        /// <see cref="EnableLog(InstallLogModes,string)"/> function.
        /// </p><p>
        /// The <see cref="RebootRequired"/> and <see cref="RebootInitiated"/> properties should be
        /// tested after calling this method.
        /// </p><p>
        /// Win32 MSI APIs:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiconfigureproduct.asp">MsiConfigureProduct</a>,
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiconfigureproductex.asp">MsiConfigureProductEx</a>
        /// </p></remarks>
        public static void ConfigureProduct(string productCode, int installLevel, InstallState installState, string commandLine)
        {
            uint ret = NativeMethods.MsiConfigureProductEx(productCode, installLevel, (int)installState, commandLine);

            Installer.CheckInstallResult(ret);
        }
Пример #4
0
        /// <summary>
        /// Configures the installed state for a product feature.
        /// </summary>
        /// <param name="productCode">Product code of the product to be configured.</param>
        /// <param name="feature">Specifies the feature ID for the feature to be configured.</param>
        /// <param name="installState">Specifies the installation state for the feature.</param>
        /// <exception cref="InstallerException">There was an error configuring the feature</exception>
        /// <remarks><p>
        /// The <see cref="RebootRequired"/> and <see cref="RebootInitiated"/> properties should be
        /// tested after calling this method.
        /// </p><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiconfigurefeature.asp">MsiConfigureFeature</a>
        /// </p></remarks>
        public static void ConfigureFeature(string productCode, string feature, InstallState installState)
        {
            uint ret = NativeMethods.MsiConfigureFeature(productCode, feature, (int)installState);

            Installer.CheckInstallResult(ret);
        }
Пример #5
0
        /// <summary>
        /// Opens an installer package and initializes an install session.
        /// </summary>
        /// <param name="packagePath">path to the patch package</param>
        /// <param name="commandLine">command line property settings</param>
        /// <exception cref="InstallerException">There was an error installing the product</exception>
        /// <remarks><p>
        /// To completely remove a product, set REMOVE=ALL in <paramRef name="commandLine"/>.
        /// </p><p>
        /// This method displays the user interface with the current settings and
        /// log mode. You can change user interface settings with the <see cref="SetInternalUI(InstallUIOptions)"/>
        /// and <see cref="SetExternalUI(ExternalUIHandler,InstallLogModes)"/> functions. You can set the log mode with the
        /// <see cref="EnableLog(InstallLogModes,string)"/> function.
        /// </p><p>
        /// The <see cref="RebootRequired"/> and <see cref="RebootInitiated"/> properties should be
        /// tested after calling this method.
        /// </p><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msiinstallproduct.asp">MsiInstallProduct</a>
        /// </p></remarks>
        public static void InstallProduct(string packagePath, string commandLine)
        {
            uint ret = NativeMethods.MsiInstallProduct(packagePath, commandLine);

            Installer.CheckInstallResult(ret);
        }