C# Compiler Options Listed by Category
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

C# Compiler Options Listed by Category

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


Option Purpose
/filealign Specify the size of sections in the output file.
/optimize Enable/disable optimizations.

Output Files

Option Purpose
/doc Process documentation comments to an XML file.
/out Specify output file.
/target Specify the format of the output file using one of four options:

.NET Framework Assemblies

Option Purpose
/addmodule Specify one or more modules to be part of this assembly.
/lib Specify the location of assemblies referenced by means of /reference.
/nostdlib Do not import standard library (mscorlib.dll).
/reference Import metadata from a file that contains an assembly.

Debugging/Error Checking

Option Purpose
/bugreport Create a file that contains information that makes it easy to report a bug.
/checked Specify whether integer arithmetic that overflows the bounds of the data type will cause an exception at run time.
/debug Emit debugging information.
/fullpaths Specify the absolute path to the file in compiler output.
/nowarn Suppress the compiler's ability to generate specified warnings.
/warn Set warning level.
/warnaserror Promote warnings to errors.


Option Purpose
/define Define preprocessor symbols.


Option Purpose
/linkresource Create a link to a managed resource.
/resource Embed a .NET Framework resource into the output file.
/win32icon Insert an .ico file into the output file.
/win32res Insert a Win32 resource into the output file.


Option Purpose
@ Specify a response file.
/? List compiler options to stdout.
/baseaddress Specify the preferred base address at which to load a DLL.
/codepage Specify the code page to use for all source code files in the compilation.
/help List compiler options to stdout.
/incremental Enable incremental compilation of source code files.
/main Specify the location of the Main method.
/noconfig Do not compile with csc.rsp.
/nologo Suppress compiler banner information.
/recurse Search subdirectories for source files to compile.
/unsafe Compile code that uses the unsafe keyword.
/utf8output Display compiler output using UTF-8 encoding.

See Also

C# Compiler Options | C# Compiler Options Listed Alphabetically | Building from the Command Line

© 2015 Microsoft