Represents the parameters used to invoke a compiler.
For a list of all members of this type, see CompilerParameters Members.
[Visual Basic] <ComVisible(False)> Public Class CompilerParameters [C#] [ComVisible(false)] public class CompilerParameters [C++] [ComVisible(false)] public __gc class CompilerParameters [JScript] public ComVisible(false) class CompilerParameters
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
A CompilerParameters object represents the settings and options for an ICodeCompiler interface.
If you are compiling an executable program, you must set the GenerateExecutable property to true. When the GenerateExecutable is set to false, the compiler will generate a class library. By default, a new CompilerParameters is initialized with its GenerateExecutable property set to false. If you are compiling an executable from a CodeDOM graph, a CodeEntryPointMethod must be defined in the graph. If there are multiple code entry points, you can indicate the class that defines the entry point to use by setting the name of the class to the MainClass property.
You can specify a file name for the output assembly in the OutputAssembly property. Otherwise, a default output file name will be used. To include debug information in a generated assembly, set the IncludeDebugInformation property to true. If your project references any assemblies, you must specify the assembly names as items in a StringCollection set to the ReferencedAssemblies property of the CompilerParameters used when invoking compilation.
You can compile an assembly that is written to memory rather than disk by setting the GenerateInMemory property to true. When an assembly is generated in memory, your code can obtain a reference to the generated assembly from the CompiledAssembly property of a CompilerResults. If an assembly is written to disk, you can obtain the path to the generated assembly from the PathToAssembly property of a CompilerResults.
To specify a warning level at which to halt compilation, set the WarningLevel property to an integer that represents the warning level at which to halt compilation. You can also configure the compiler to halt compilation if warnings are encountered by setting the TreatWarningsAsErrors property to true.
To specify a custom command-line arguments string to use when invoking the compilation process, set the string in the CompilerOptions property. If a Win32 security token is required to invoke the compiler process, specify the token in the UserToken property. To link a Win32 resource file into the compiled assembly, specify the name of the Win32 resource file in the Win32Resource property.
Note When building an executable, be sure to set the GenerateExecutable property to true. The default value of this property is false, which causes the compiler to generate a class library.
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)