Пример #1
0
        public static string GetIisVersion(IScriptExecutionEnvironment environment, bool failIfNotExist)
        {
            string major;

            if (environment.IsConfigSettingDefined(IisMajorVersion))
            {
                major = environment.GetConfigSetting(IisMajorVersion);
            }
            else
            {
                ExecuteTask(environment);
                major = environment.GetConfigSetting(IisMajorVersion);
            }

            if (string.IsNullOrEmpty(major))
            {
                const string Msg = "IIS not installed or IIS access denied!";
                if (failIfNotExist)
                {
                    throw new RunnerFailedException(Msg);
                }
                environment.LogMessage(Msg);

                return("0.0");
            }

            string minor = environment.GetConfigSetting(IisMinorVersion);

            return(major + "." + minor);
        }