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 Shared Function GetAllCompilerInfo As CompilerInfo()

Return Value

Type: System.CodeDom.Compiler.CompilerInfo()

An array of type CompilerInfo representing the settings of all configured CodeDomProvider implementations.

Exception Condition
SecurityException

The caller does not have the required permission.

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

System_CAPS_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.

Dim allCompilerInfo As CompilerInfo() = CodeDomProvider.GetAllCompilerInfo()
Dim info As CompilerInfo
For Each info In  allCompilerInfo

   Dim defaultLanguage As String
   Dim defaultExtension As String

   Dim provider As CodeDomProvider = info.CreateProvider()

   ' Display information about this configured provider.
   Console.WriteLine("Language provider:  {0}", _
       provider.ToString())
   Console.WriteLine()

   Console.WriteLine("  Supported file extension(s):")
   Dim extension As String
   For Each extension In info.GetExtensions()
      Console.WriteLine("    {0}", extension)
   Next extension

   defaultExtension = provider.FileExtension
   If Not defaultExtension.StartsWith(".") Then
      defaultExtension = "." + defaultExtension
   End If

   Console.WriteLine("  Default file extension:  {0}", _
     defaultExtension)
   Console.WriteLine()

   Console.WriteLine("  Supported language(s):")
   Dim language As String
   For Each language In  info.GetLanguages()
      Console.WriteLine("    {0}", language)
   Next language
   defaultLanguage = CodeDomProvider.GetLanguageFromExtension(defaultExtension)
   Console.WriteLine("  Default language:        {0}", _
      defaultLanguage)
   Console.WriteLine()

   ' Get the compiler settings for this provider.
   Dim langCompilerConfig As CompilerParameters = info.CreateDefaultCompilerParameters()

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

SecurityAction.LinkDemand

for full trust for the immediate caller. This member cannot be used by partially trusted code.

.NET Framework
Available since 2.0
Return to top
Show: