Freigeben über


C# Compiler Options Listed by Category

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

Optimization

Option

Purpose

/filealign

Specifies the size of sections in the output file.

/optimize

Enables/disables optimizations.

Output Files

Option

Purpose

/doc

Specifies an XML file where processed documentation comments are to be written.

/out

Specifies the output file.

/pdb

Specifies the file name and location of the .pdb file.

/platform

Specify the output platform.

/preferreduilang

Specify a language for compiler output.

/target

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

Option

Purpose

/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 /reference.

/nostdlib

Instructs the compiler not to import the standard library (mscorlib.dll).

/reference

Imports metadata from a file that contains an assembly.

Debugging/Error Checking

Option

Purpose

/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.

Preprocessor

Option

Purpose

/define

Defines preprocessor symbols.

Resources

Option

Purpose

/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.

Miscellaneous

Option

Purpose

@

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

Specifies what version of the language to use.

/main

Specifies the location of the Main method.

/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 unsafe keyword.

/utf8output

Displays compiler output using UTF-8 encoding.

Obsolete Options

/incremental

Enables incremental compilation.

See Also

Tasks

How to: Set Environment Variables

Reference

C# Compiler Options Listed Alphabetically

Other Resources

C# Compiler Options