Export (0) Print
Expand All

CodeDomProvider.GetAllCompilerInfo Method

Returns the language provider and compiler configuration settings for this computer.

Namespace:  System.CodeDom.Compiler
Assembly:  System (in System.dll)

[ComVisibleAttribute(false)]
public static CompilerInfo[] GetAllCompilerInfo()

Return Value

Type: System.CodeDom.Compiler.CompilerInfo[]
An array of type CompilerInfo representing the settings of all configured CodeDomProvider implementations.

ExceptionCondition
SecurityException

The caller does not have the required permission.

Use the GetAllCompilerInfo method to enumerate the language provider settings on a computer.

NoteNote

In the .NET Framework 2.0, the default language providers supplied by the .NET Framework are not specified in the <system.codedom> Element compiler configuration section and cannot be removed, so this method returns information about the default providers and any specified in the configuration file.

The following code example enumerates the language providers on the computer and displays the configuration and compiler settings for each language provider. This code example is part of a larger example provided for the CompilerInfo class.

CompilerInfo [] allCompilerInfo = CodeDomProvider.GetAllCompilerInfo();
foreach (CompilerInfo info in allCompilerInfo)
{
    String defaultLanguage;
    String defaultExtension;

    CodeDomProvider provider = info.CreateProvider();

    // Display information about this configured provider.

    Console.WriteLine("Language provider:  {0}", 
        provider.ToString());
    Console.WriteLine();

    Console.WriteLine("  Supported file extension(s):");
    foreach(String extension in info.GetExtensions())
    { 
        Console.WriteLine("    {0}", extension);
    }

    defaultExtension = provider.FileExtension;
    if (defaultExtension[0] != '.')
    {
        defaultExtension = "." + defaultExtension;
    }
    Console.WriteLine("  Default file extension:  {0}", 
        defaultExtension);
    Console.WriteLine();

    Console.WriteLine("  Supported language(s):");
    foreach(String language in info.GetLanguages())
    { 
        Console.WriteLine("    {0}", language);
    }

    defaultLanguage = CodeDomProvider.GetLanguageFromExtension(defaultExtension);
    Console.WriteLine("  Default language:        {0}",
        defaultLanguage);
    Console.WriteLine();

    // Get the compiler settings for this provider.
    CompilerParameters langCompilerConfig = info.CreateDefaultCompilerParameters();

    Console.WriteLine("  Compiler options:        {0}", 
        langCompilerConfig.CompilerOptions);
    Console.WriteLine("  Compiler warning level:  {0}", 
        langCompilerConfig.WarningLevel);
    Console.WriteLine();
}

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft