C# Compiler Options Listed by Category
The following compiler options are sorted by category. For an alphabetical list, see C# Compiler Options Listed Alphabetically.
Optimization
Option |
Purpose |
---|---|
Specifies the size of sections in the output file. |
|
Enables/disables optimizations. |
Output Files
Option |
Purpose |
---|---|
Specifies an XML file where processed documentation comments are to be written. |
|
Specifies the output file. |
|
Specifies the file name and location of the .pdb file. |
|
Specify the output platform. |
|
Specifies the format of the output file using one of four options:/target:exe/target:library/target:module/target:winexe |
.NET Framework Assemblies
Option |
Purpose |
---|---|
Specifies one or more modules to be part of this assembly. |
|
Instructs the compiler to add the public key but to leave the assembly unsigned. |
|
Specifies the name of the cryptographic key container. |
|
Specifies the filename containing the cryptographic key. |
|
Specifies the location of assemblies referenced by means of /reference. |
|
Instructs the compiler not to import the standard library (mscorlib.dll). |
|
Imports metadata from a file that contains an assembly. |
Debugging/Error Checking
Option |
Purpose |
---|---|
Creates a file that contains information that makes it easy to report a bug. |
|
Specifies whether integer arithmetic that overflows the bounds of the data type will cause an exception at run time. |
|
Instruct the compiler to emit debugging information. |
|
Sets error reporting behavior. |
|
Specifies the absolute path to the file in compiler output. |
|
Suppresses the compiler's generation of specified warnings. |
|
Sets the warning level. |
|
Promotes warnings to errors. |
Preprocessor
Option |
Purpose |
---|---|
Defines preprocessor symbols. |
Resources
Option |
Purpose |
---|---|
Makes COM type information in specified assemblies available to the project. |
|
Creates a link to a managed resource. |
|
Embeds a .NET Framework resource into the output file. |
|
Specifies an .ico file to insert into the output file. |
|
Specifies a Win32 resource to insert into the output file. |
Miscellaneous
Option |
Purpose |
---|---|
Specifies a response file. |
|
Lists compiler options to stdout. |
|
Specifies the preferred base address at which to load a DLL. |
|
Specifies the code page to use for all source code files in the compilation. |
|
Lists compiler options to stdout. |
|
Specifies what version of the language to use. |
|
Specifies the location of the Main method. |
|
Instructs the compiler not to compile with csc.rsp. |
|
Suppresses compiler banner information. |
|
Searches subdirectories for source files to compile. |
|
Enables compilation of code that uses the unsafe keyword. |
|
Displays compiler output using UTF-8 encoding. |
Obsolete Options
/incremental |
Enables incremental compilation. |
See Also
Tasks
How to: Set Environment Variables
Reference
C# Compiler Options Listed Alphabetically