Example #1
0
        /// <summary>
        /// Returns the value of the providerOption specified for the codedom provider type.
        /// Returns null if the providerOption is not found.
        /// </summary>
        internal static string GetProviderOption(Type codeDomProviderType, string providerOption)
        {
            IDictionary <string, string> providerOptions = CompilationUtil.GetProviderOptions(codeDomProviderType);

            if (providerOptions != null)
            {
                string version;
                if (providerOptions.TryGetValue(providerOption, out version))
                {
                    return(version);
                }
            }
            return(null);
        }
        private static void ProcessProviderOptions(Type codeDomProviderType, CompilerParameters compilParams)
        {
            IDictionary <string, string> providerOptions = CompilationUtil.GetProviderOptions(codeDomProviderType);

            if (providerOptions != null)
            {
                if ((codeDomProviderType == typeof(VBCodeProvider)) || (codeDomProviderType == typeof(CSharpCodeProvider)))
                {
                    ProcessBooleanProviderOption("WarnAsError", "/warnaserror+", "/warnaserror-", providerOptions, compilParams);
                }
                if (((codeDomProviderType != null) && CompilationUtil.IsCompilerVersion35OrAbove(codeDomProviderType)) && (codeDomProviderType == typeof(VBCodeProvider)))
                {
                    ProcessBooleanProviderOption("OptionInfer", "/optionInfer+", "/optionInfer-", providerOptions, compilParams);
                }
            }
        }