Mono open source ECMA CLI, C# and .NET implementation.
Mono is a software platform designed to allow developers to easily create cross platform applications. It is an open source implementation of Microsoft's .NET Framework based on the ECMA standards for C# and the Common Language Runtime.
The Mono project is part of the .NET Foundation
Join us on Discord in the
Legacy Jenkins CI (no longer available publicly):
| OS | Architecture | Status | |--------------|--------------------|------------------------------| | Debian 9 | amd64 | | | Debian 9 | i386 | | | Debian 9 | armel | | | Debian 9 | armhf | | | Debian 9 | arm64 | | | OS X | amd64 | | | OS X | i386 | | | Windows | amd64 | | | Windows | i386 | | | CentOS | s390x (cs) | | | Debian 9 | ppc64el (cs) | | | AIX 6.1 | ppc64 (cs) | | | FreeBSD 12 | amd64 (cs) | |
(cs) = community supported architecture
Note that building from Git assumes that you already have Mono installed, so please download and install the latest Mono release before trying to build from Git. This is required because the Mono build relies on a working Mono C# compiler to compile itself (also known as bootstrapping).
If you don't have a working Mono installation, you can try a slightly more risky approach: getting the latest version of the 'monolite' distribution, which contains just enough to run the 'mcs' compiler. You do this with:
# Run the following line after ./autogen.sh make get-monolite-latest
This will download and place the files appropriately so that you can then just run:
The build will then use the files downloaded by
You can run the mono and mcs test suites with the command:
Expect to find a few test suite failures. As a sanity check, you can compare the failures you got with https://jenkins.mono-project.com/.
You can now install mono with:
You can verify your installation by using the mono-test-install script, it can diagnose some common problems with Mono's install. Failure to follow these steps may result in a broken installation.
Once you have installed the software, you can run a few programs:
mono program.exeruntime engine
mcs program.csC# compiler
monodis program.exeCIL Disassembler
See the man pages for mono(1), mcs(1) and monodis(1) for further details.
acceptance-tests/- Optional third party test suites used to validate Mono against a wider range of test cases.
data/- Configuration files installed as part of the Mono runtime.
docs/- Technical documents about the Mono runtime.
external/- Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
ikvm-native/- Glue code for ikvm.
libgc/- The (deprecated) Boehm GC implementation.
llvm/- Utility Makefiles for integrating the Mono LLVM fork.
m4/- General utility Makefiles.
man/- Manual pages for the various Mono commands and programs.
mcs/- The class libraries, compiler and tools
class/- The class libraries (like System.*, Microsoft.Build, etc.)
mcs/- The Mono C# compiler written in C#
tools/- Tools like gacutil, ikdasm, mdoc, etc.
mono/- The core of the Mono Runtime.
arch/- Architecture specific portions.
benchmark/- A collection of benchmarks.
btls/- Build files for the BTLS library which incorporates BoringSSL.
cil/- Common Intermediate Representation, XML definition of the CIL bytecodes.
dis/- CIL executable Disassembler.
eglib/- Independent implementation of the glib API.
metadata/- The object system and metadata reader.
mini/- The Just in Time Compiler.
profiler/- The profiler implementation.
sgen/- The SGen Garbage Collector implementation.
tests/- The main runtime tests.
unit-tests/- Additional runtime unit tests.
utils/- Utility functions used across the runtime codebase.
msvc/- Logic for the MSVC / Visual Studio based runtime and BCL build system. The latter is experimental at the moment.
packaging/- Packaging logic for the OS X and Windows Mono packages.
po/- Translation files.
runtime/- A directory that contains the Makefiles that link the mono/ and mcs/ build systems.
samples/- Some simple sample programs on uses of the Mono runtime as an embedded library.
scripts/- Scripts used to invoke Mono and the corresponding program.
sdks/- A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
support/- Various support libraries.
tools/- A collection of tools, mostly used during Mono development.
To submit bug reports, please open an issue on the mono GitHub repo.
Please use the search facility to ensure the same bug hasn't already been submitted and follow our guidelines on how to make a good bug report.
The following are the configuration options that someone building Mono might want to use:
--with-sgen=yes,no- Generational GC support: Used to enable or disable the compilation of a Mono runtime with the SGen garbage collector.
mono-boehmbinary and a
mono-boehmuses Boehm, while
mono-sgenuses the Simple Generational GC.
--with-libgc=[included, none]- Selects the default Boehm garbage collector engine to use.
yes, it will turn stack overflows into the StackOverflowException. Otherwise when a stack overflow happens, your program will receive a segmentation fault.
monoshould link against a static library (libmono.a) or a shared library (libmono.so).
yes, and will improve the performance of the
--with-xen-opt=yes,no- Optimize code for Xen virtualization.
--with-large-heap=yes,no- Enable support for GC heaps larger than 3GB.
--enable-small-config=yes,no- Enable some tweaks to reduce memory usage and disk footprint at the expense of some capabilities.
--with-ikvm-native=yes,no- Controls whether the IKVM JNI interface library is built or not.
--with-profile4=yes,no- Whether you want to build the 4.x profile libraries and runtime.
--with-libgdiplus=installed,sibling,- Configure where Mono searches for libgdiplus when running System.Drawing tests.
installed, which means that the library is available to Mono through the regular system setup.
siblingcan be used to specify that a libgdiplus that resides as a sibling of this directory (mono) should be used.
aot: Disables support for the Ahead of Time compilation.
attach: Support for the Mono.Management assembly and the VMAttach API (allowing code to be injected into a target VM)
com: Disables COM support.
debug: Drop debugging support.
decimal: Disables support for System.Decimal.
full_messages: By default Mono comes with a full table of messages for error codes. This feature turns off uncommon error messages and reduces the runtime size.
generics: Generics support. Disabling this will not allow Mono to run any 2.0 libraries or code that contains generics.
jit: Removes the JIT engine from the build, this reduces the executable size, and requires that all code executed by the virtual machine be compiled with Full AOT before execution.
large_code: Disables support for large assemblies.
logging: Disables support for debug logging.
pinvoke: Support for Platform Invocation services, disabling this will drop support for any libraries using DllImport.
portability: Removes support for MONO_IOMAP, the environment variables for simplifying porting applications that are case-insensitive and that mix the Unix and Windows path separators.
profiler: Disables support for the default profiler.
reflection_emit: Drop System.Reflection.Emit support
reflection_emit_save: Drop support for saving dynamically created assemblies (AssemblyBuilderAccess.Save) in System.Reflection.Emit.
shadow_copy: Disables support for AppDomain's shadow copies (you can disable this if you do not plan on using appdomains).
simd: Disables support for the Mono.SIMD intrinsics library.
ssa: Disables compilation for the SSA optimization framework, and the various SSA-based optimizations.
--enable-big-arrays- Enable use of arrays with indexes larger than Int32.MaxValue.
If you specify "mcs", then Mono's C# compiler will be used. This also allows for a complete bootstrap of Mono's core compiler and core libraries from source.
If you specify "roslyn", then Roslyn's C# compiler will be used. This currently uses Roslyn binaries.
--targetand ignored what config.sub guesses.
This is a workaround to enable usage of old automake versions that don't recognize the wasm triplet.
Mono references several external git submodules, for example a fork of Microsoft's reference source code that has been altered to be suitable for use with the Mono runtime.
This section describes how to use it.
An initial clone should be done recursively so all submodules will also be cloned in a single pass:
$ git clone --recursive [email protected]:mono/mono
Once cloned, submodules can be updated to pull down the latest changes. This can also be done after an initial non-recursive clone:
$ git submodule update --init --recursive
To pull external changes into a submodule:
$ cd $ git pull origin $ cd $ git add $ git commit
By default, submodules are detached because they point to a specific commit. Use
git checkoutto move back to a branch before making changes:
$ cd $ git checkout # work as normal; the submodule is a normal repo $ git commit/push new changes to the repo (submodule)
$ cd $ git add # this will record the new commits to the submodule $ git commit
To switch the repo of a submodule (this should not be a common or normal thing to do at all), first edit
.gitmodulesto point to the new location, then:
$ git submodule sync -- $ git submodule update --recursive $ git checkout
The desired output diff is a change in
.gitmodulesto reflect the change in the remote URL, and a change in / where you see the desired change in the commit hash.
See the LICENSE file for licensing information, and the PATENTS.TXT file for information about Microsoft's patent grant.
The use of trademarks and logos for Mono can be found here.