Пример #1
0
        /// <summary>
        /// Sets the install level for the current installation to a specified value and
        /// recalculates the Select and Installed states for all features in the Feature
        /// table. Also sets the Action state of each component in the Component table based
        /// on the new level.
        /// </summary>
        /// <param name="installLevel">New install level</param>
        /// <exception cref="InvalidHandleException">the Session handle is invalid</exception>
        /// <remarks><p>
        /// The SetInstallLevel method sets the following:<list type="bullet">
        /// <item><description>The installation level for the current installation to a specified value</description></item>
        /// <item><description>The Select and Installed states for all features in the Feature table</description></item>
        /// <item><description>The Action state of each component in the Component table, based on the new level</description></item>
        /// </list>
        /// If 0 or a negative number is passed in the ilnstallLevel parameter,
        /// the current installation level does not change, but all features are still
        /// updated based on the current installation level.
        /// </p><p>
        /// Win32 MSI API:
        /// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msisetinstalllevel.asp">MsiSetInstallLevel</a>
        /// </p></remarks>
        public void SetInstallLevel(int installLevel)
        {
            this.ValidateSessionAccess();

            uint ret = RemotableNativeMethods.MsiSetInstallLevel((int)this.Handle, installLevel);

            if (ret != 0)
            {
                throw InstallerException.ExceptionFromReturnCode(ret);
            }
        }