Forrest logo
tool overview
On this page you find all important commands for the CLI tool csc. If the command you are looking for is missing please ask our AI.

csc

The "csc" command line tool stands for "C# Compiler". It is a command line utility provided by Microsoft as part of the .NET Framework to compile C# source code files (.cs) into executable or library files.

The C# Compiler, csc.exe, takes C# source code as input and generates an assembly containing the compiled code. It follows the syntax:

csc [options] [source files]

Some common options include:

  • /target: Specifies the type of output file, such as "exe" for an executable or "library" for a DLL.
  • /out: Specifies the name of the output file.
  • /reference: Specifies the assembly files (.dll or .exe) that the source code references.
  • /optimize: Enables code optimization to enhance performance.
  • /warnaserror: Treats all warnings as errors.
  • /help: Displays help information about the available options and usage of csc.exe.

Using the "csc" command line tool, developers can compile C# code without the need for an Integrated Development Environment (IDE) like Visual Studio. It provides flexibility and automation for building C# projects, allowing developers to incorporate it into build scripts or integrate it into their development workflow.

List of commands for csc:

  • csc:tldr:33dee csc: Compile one or more C# files to a CIL executable.
    $ csc ${path-to-input_file_a-cs} ${path-to-input_file_b-cs}
    try on your machine
    explain this command
  • csc:tldr:3518d csc: Automatically generate XML documentation.
    $ csc /doc:${path-to-output-xml} ${path-to-input_file-cs}
    try on your machine
    explain this command
  • csc:tldr:5ed59 csc: Reference another assembly.
    $ csc /reference:${path-to-library-dll} ${path-to-input_file-cs}
    try on your machine
    explain this command
  • csc:tldr:7bfc5 csc: Strongly-name the resulting assembly with a keyfile.
    $ csc /keyfile:${path-to-keyfile} ${path-to-input_file-cs}
    try on your machine
    explain this command
  • csc:tldr:95750 csc: Embed a resource.
    $ csc /resource:${path-to-resource_file} ${path-to-input_file-cs}
    try on your machine
    explain this command
  • csc:tldr:95b88 csc: Specify the output filename.
    $ csc /out:${filenamename} ${path-to-input_file-cs}
    try on your machine
    explain this command
  • csc:tldr:a6e7c csc: Compile into a `.dll` library instead of an executable.
    $ csc /target:library ${path-to-input_file-cs}
    try on your machine
    explain this command
tool overview