示例#1
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);
        }