C# Compiler Options Listed by Category

The following compiler options are sorted by category. For an alphabetical list, see C# Compiler Options Listed Alphabetically.





Specifies the size of sections in the output file.


Enables/disables optimizations.

Output Files




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.


Specify a language for compiler output.


Specifies the format of the output file using one of five options: /target:appcontainerexe, /target:exe, /target:library, /target:module, /target:winexe, or /target:winmdobj.

.NET Framework Assemblies




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




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.





Defines preprocessor symbols.





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.





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 that the executable file supports address space layout randomization (ASLR).


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.


Specifies the minimum version of the subsystem that the executable file can use.


Enables compilation of code that uses the unsafe keyword.


Displays compiler output using UTF-8 encoding.

Obsolete Options


Enables incremental compilation.

See Also


How to: Set Environment Variables


C# Compiler Options Listed Alphabetically

Other Resources

C# Compiler Options