Back to Roslyn

Visual C# Compiler Options

docs/compilers/CSharp/CommandLine.md

11.0.1006.7 KB
Original Source

Visual C# Compiler Options

FLAGDESCRIPTION
OUTPUT FILES
/out:fileSpecify output file name (default: base name of file with main class or first file)
/refout:fileSpecify the reference assembly's output file name
/target:exeBuild a console executable (default) (Short form: /t:exe)
/target:winexeBuild a Windows executable (Short form: /t:winexe )
/target:libraryBuild a library (Short form: /t:library)
/target:moduleBuild a module that can be added to another assembly (Short form: /t:module)
/target:appcontainerexeBuild an Appcontainer executable (Short form: /t:appcontainerexe)
/target:winmdobjBuild a Windows Runtime intermediate file that is consumed by WinMDExp (Short form: /t:winmdobj)
/doc:fileXML Documentation file to generate
/platform:stringLimit which platforms this code can run on: x86, Itanium, x64, arm, anycpu32bitpreferred, or anycpu. The default is anycpu.
INPUT FILES
/recurse:wildcardInclude all files in the current directory and subdirectories according to the wildcard specifications
/reference:alias=fileReference metadata from the specified assembly file using the given alias (Short form: /r)
/reference:file listReference metadata from the specified assembly files (Short form: /r)
/addmodule:file listLink the specified modules into this assembly
/link:file listEmbed metadata from the specified interop assembly files (Short form: /l)
/analyzer:file listRun the analyzers from this assembly (Short form: /a)
/additionalfile:file listAdditional files that don't directly affect code generation but may be used by analyzers for producing errors or warnings.
RESOURCES
/win32res:fileSpecify a Win32 resource file (.res)
/win32icon:fileUse this icon for the output
/win32manifest:fileSpecify a Win32 manifest file (.xml)
/nowin32manifestDo not include the default Win32 manifest
/resource:resinfoEmbed the specified resource (Short form: /res)
/linkresource:resinfoLink the specified resource to this assembly (Short form: /linkres) Where the resinfo format is file{,string name{`,public
CODE GENERATION
/debug{+|-}Emit (or do not Emit) debugging information
/debug:fullEmit debugging information to .pdb file using default format for the current platform: Windows PDB on Windows, Portable PDB on other systems
/debug:pdbonlySame as /debug:full. For backward compatibility.
/debug:portableEmit debugging information to to .pdb file using cross-platform Portable PDB format
/debug:embeddedEmit debugging information into the .dll/.exe itself (.pdb file is not produced) using Portable PDB format.
/sourcelink:fileSource link info to embed into PDB.
/optimize{+|-}Enable optimizations (Short form: /o)
/deterministicProduce a deterministic assembly (including module version GUID and timestamp)
/refonlyProduce a reference assembly, instead of a full assembly, as the primary output
ERRORS AND WARNINGS
/warnaserror{+|-}Report all warnings as errors
/warnaserror{+|-}:warn listReport specific warnings as errors
/warn:nSet warning level (non-negative integer) (Short form: /w)
/nowarn:warn listDisable specific warning messages
/ruleset:fileSpecify a ruleset file that disables specific diagnostics.
/errorlog:fileSpecify a file to log all compiler and analyzer diagnostics.
/reportanalyzerReport additional analyzer information, such as execution time.
LANGUAGE
/checked{+|-}Generate overflow checks
/unsafe{+|-}Allow 'unsafe' code
/define:symbol listDefine conditional compilation symbol(s) (Short form: /d)
/langversion:?Display the allowed values for language version
/langversion:stringSpecify language version such as default (latest major version), or latest (latest version, including minor versions)
SECURITY
/delaysign{+|-}Delay-sign the assembly using only the public portion of the strong name key
/keyfile:fileSpecify a strong name key file
/keycontainer:stringSpecify a strong name key container
/highentropyva{+|-}Enable high-entropy ASLR
MISCELLANEOUS
@fileRead response file for more options
/helpDisplay a usage message (Short form: /?)
/nologoSuppress compiler copyright message
/noconfigDo not auto include CSC.RSP file
/parallel{+|-}Concurrent build.
ADVANCED
/baseaddress:addressBase address for the library to be built
/bugreport:fileCreate a 'Bug Report' file
/checksumalgorithm:algSpecify algorithm for calculating source file checksum stored in PDB. Supported values are: SHA1 (default) or SHA256.
/codepage:nSpecify the codepage to use when opening source files
/utf8outputOutput compiler messages in UTF-8 encoding
/main:typeSpecify the type that contains the entry point (ignore all other possible entry points) (Short form: /m)
/fullpathsCompiler generates fully qualified paths
/filealign:nSpecify the alignment used for output file sections
/pathmap:k1=v1,k2=v2,...Specify a mapping for source path names output by the compiler. Two consecutive separator characters are treated as a single character that is part of the key or value (i.e. == stands for = and ,, for ,).
/pdb:fileSpecify debug information file name (default: output file name with .pdb extension)
/errorendlocationOutput line and column of the end location of each error
/preferreduilangSpecify the preferred output language name.
/nostdlib{+|-}Do not reference standard library mscorlib.dll
/subsystemversion:stringSpecify subsystem version of this assembly
/lib:file listSpecify additional directories to search in for references
/errorreport:stringSpecify how to handle internal compiler errors: prompt, send, queue, or none. The default is queue.
/appconfig:fileSpecify an application configuration file containing assembly binding settings
/moduleassemblyname:stringName of the assembly which this module will be a part of
/modulename:stringSpecify the name of the source module