Contents C# Compiler Options Listed by Category
2 minutes to read
In this article
The following compiler options are sorted by category. For an alphabetical list, see
C# Compiler Options Listed Alphabetically. Optimization
-filealign Specifies the size of sections in the output file.
-optimize Enables/disables optimizations.
.NET Framework Assemblies
-addmodule Specifies one or more modules to be part of this assembly.
-delaysign Instructs the compiler to add the public key but to leave the assembly unsigned.
-keycontainer Specifies the name of the cryptographic key container.
-keyfile Specifies the filename containing the cryptographic key.
-lib Specifies the location of assemblies referenced by means of
-nostdlib Instructs the compiler not to import the standard library (mscorlib.dll).
-reference Imports metadata from a file that contains an assembly.
Run the analyzers from this assembly (Short form: /a)
Names additional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings.
-bugreport Creates a file that contains information that makes it easy to report a bug.
-checked Specifies whether integer arithmetic that overflows the bounds of the data type will cause an exception at run time.
-debug Instruct the compiler to emit debugging information.
-errorreport Sets error reporting behavior.
-fullpaths Specifies the absolute path to the file in compiler output.
-nowarn Suppresses the compiler's generation of specified warnings.
-warn Sets the warning level.
-warnaserror Promotes warnings to errors.
Specify a ruleset file that disables specific diagnostics.
-define Defines preprocessor symbols.
-link Makes COM type information in specified assemblies available to the project.
-linkresource Creates a link to a managed resource.
-resource Embeds a .NET Framework resource into the output file.
-win32icon Specifies an .ico file to insert into the output file.
-win32res Specifies a Win32 resource to insert into the output file.
@ Specifies a response file.
-? Lists compiler options to stdout.
-baseaddress Specifies the preferred base address at which to load a DLL.
-codepage Specifies the code page to use for all source code files in the compilation.
-help Lists compiler options to stdout.
-highentropyva Specifies that the executable file supports address space layout randomization (ASLR).
-langversion Specify language version mode: Default, ISO-1, ISO-2, 3, 4, 5, 6, 7, 7.1, or Latest
-main Specifies the location of the
-noconfig Instructs the compiler not to compile with csc.rsp.
-nologo Suppresses compiler banner information.
-recurse Searches subdirectories for source files to compile.
-subsystemversion Specifies the minimum version of the subsystem that the executable file can use.
-unsafe Enables compilation of code that uses the
-utf8output Displays compiler output using UTF-8 encoding.
Specifies whether to use concurrent build (+).
Specify the algorithm for calculating the source file checksum stored in PDB. Supported values are: SHA1 (default) or SHA256.
Enables incremental compilation.
C# Compiler Options C# Compiler Options Listed Alphabetically How to: Set Environment Variables for the Visual Studio Command Line
The feedback system for this content will be changing soon. Old comments will not be carried over. If content within a comment thread is important to you, please save a copy. For more information on the upcoming change,
we invite you to read our blog post.