C# Compiler Options Listed Alphabetically


Updated: July 20, 2015

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

The following compiler options are sorted alphabetically. For a categorical list, see C# Compiler Options Listed by Category.

@Reads a response file for more options.
/?Displays a usage message to stdout.
/additionalfileNames additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings.
/addmoduleLinks the specified modules into this assembly
/analyzerRun the analyzers from this assembly (Short form: /a)
/appconfigSpecifies the location of app.config at assembly binding time.
/baseaddressSpecifies the base address for the library to be built.
/bugreportCreates a 'Bug Report' file. This file will be sent together with any crash information if it is used with /errorreport:prompt or /errorreport:send.
/checkedCauses the compiler to generate overflow checks.
/checksumalgorithm:<alg>Specify the algorithm for calculating the source file checksum stored in PDB. Supported values are: SHA1 (default) or SHA256.
/codepageSpecifies the codepage to use when opening source files.
/debugEmits debugging information.
/defineDefines conditional compilation symbols.
/delaysignDelay-signs the assembly by using only the public part of the strong name key.
/docSpecifies an XML Documentation file to generate.
/errorreportSpecifies how to handle internal compiler errors: prompt, send, or none. The default is none.
/filealignSpecifies the alignment used for output file sections.
/fullpathsCauses the compiler to generate fully qualified paths.
/helpDisplays a usage message to stdout.
/highentropyvaSpecifies that high entropy ASLR is supported.
/incrementalEnables incremental compilation [obsolete].
/keycontainerSpecifies a strong name key container.
/keyfileSpecifies a strong name key file.
/langversion:<string>Specify language version mode: ISO-1, ISO-2, 3, 4, 5, 6, or Default
/libSpecifies additional directories in which to search for references.
/linkMakes COM type information in specified assemblies available to the project.
/linkresourceLinks the specified resource to this assembly.
/mainSpecifies the type that contains the entry point (ignore all other possible entry points).
/moduleassemblynameSpecifies an assembly whose non-public types a .netmodule can access.
/modulename:<string>Specify the name of the source module
/noconfigInstructs the compiler not to auto include CSC.RSP file.
/nologoSuppresses compiler copyright message.
/nostdlibInstructs the compiler not to reference standard library (mscorlib.dll).
/nowarnDisables specific warning messages
/nowin32manifestInstructs the compiler not to embed an application manifest in the executable file.
/optimizeEnables/disables optimizations.
/outSpecifies the output file name (default: base name of file with main class or first file).
/parallel[+&#124;-]Specifies whether to use concurrent build (+).
/pdbSpecifies the file name and location of the .pdb file.
/platformLimits which platforms this code can run on: x86, Itanium, x64, anycpu, or anycpu32bitpreferred. The default is anycpu.
/preferreduilangSpecifies the language to be used for compiler output.
/recurseIncludes all files in the current directory and subdirectories according to the wildcard specifications.
/referenceReferences metadata from the specified assembly files.
/resourceEmbeds the specified resource.
/ruleset:<file>Specify a ruleset file that disables specific diagnostics.
/subsystemversionSpecifies the minimum version of the subsystem that the executable file can use.
/targetSpecifies the format of the output file by using one of four options:/target:appcontainerexe, /target:exe, /target:library, /target:module, /target:winexe, /target:winmdobj.
/unsafeAllows unsafe code.
/utf8outputOutputs compiler messages in UTF-8 encoding.
/warnSets the warning level (0-4).
/warnaserrorReports specific warnings as errors.
/win32iconUses this icon for the output.
/win32manifestSpecifies a custom win32 manifest file.
/win32resSpecifies the win32 resource file (.res).

C# Compiler Options
C# Compiler Options Listed by Category
How to: Set Environment Variables for the Visual Studio Command Line
<compiler> Element