mcs
Modify code signing attributes of Mach-O binaries
TLDR
Compile the specified files
Specify the output program name
Specify the output program type
SYNOPSIS
mcs [options] files
PARAMETERS
-out:
Specify the output file name.
-target:
Specify the target type (exe, library, module, winexe, appbundle). Default is exe.
-debug[:{full|pdbonly}]
Emit debugging information. 'full' emits full debugging information, 'pdbonly' emits PDB only.
-define:
Define preprocessor symbols (e.g., -define:DEBUG;TRACE).
-reference:
Reference assembly files (e.g., -reference:System.dll).
-lib:
Add a directory to the assembly search path.
-optimize[+|-]
Enable or disable optimizations (default is enabled).
-warn:
Set the warning level (0-4, default is 4).
-langversion:
Specify language version support (e.g. ISO-1, ISO-2, 3, 4, 5, 6, 7.0, 7.1, 7.2, 7.3, 8.0, 9.0, 10.0, 11.0, 12.0, latest, latestmajor)
-codepage:
Specify the codepage to use when opening source code files.
DESCRIPTION
The mcs command is the command-line compiler for the Mono C# compiler. It translates C# source code (.cs files) into executable files (either .exe for Windows, or executables without extension under Linux). It supports a wide range of C# language features and allows developers to build .NET applications on Linux. The compiler allows one to specify various options to control the compilation process. These options include defining preprocessor symbols, specifying the target framework, adding references to other libraries, and setting the optimization level. Understanding and utilizing these options is crucial for creating efficient and robust C# applications in a Linux environment. When compiling for .NET Framework, one can choose between various compiler settings and different frameworks, with different .NET versions (2.0, 3.5, 4.0 and 4.5) being supported.
Compilation creates .NET Common Intermediate Language (CIL) code, similar to Java bytecode and then .NET runtime executes this code.
CAVEATS
The mcs command relies on the Mono framework being properly installed and configured. Ensure that the necessary Mono packages are installed on your system.
EXIT STATUS
The mcs command returns 0 on successful compilation, and a non-zero value on failure.
CONFIGURATION FILES
The compiler can be configured using configuration files, allowing for default compiler settings to be specified.
HISTORY
mcs is the C# compiler distributed as part of the Mono project. Mono was created to provide a cross-platform implementation of the .NET framework. The mcs compiler aimed to be compatible with the Microsoft C# compiler but provided cross-platform capability. Over time the focus of the .NET implementation moved from Mono to .NET Core (now .NET) which is also cross-platform and has its own compiler (csc).
SEE ALSO
mono(1), gmcs(1)