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