1 Mono is a software platform designed to allow developers to easily
2 create cross platform applications. It is an open source
3 implementation of Microsoft's .NET Framework based on the ECMA
4 standards for C# and the Common Language Runtime.
6 The Mono project is part of the [.NET Foundation](https://www.dotnetfoundation.org/)
8 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mono/mono?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
10 1. [Compilation and Installation](#compilation-and-installation)
11 2. [Using Mono](#using-mono)
12 3. [Directory Roadmap](#directory-roadmap)
13 4. [Contributing to Mono](#contributing-to-mono)
14 5. [Reporting bugs](#reporting-bugs)
15 6. [Configuration Options](#configuration-options)
16 7. [Working with Submodules](#working-with-submodules)
20 | OS | Architecture | Status |
21 |--------------|--------------------|------------------------------|
22 | Debian 9 | amd64 | [![debian-9-amd64][1]][2] |
23 | Debian 9 | i386 | [![debian-9-i386][3]][4] |
24 | Debian 9 | armel | [![debian-9-armel][5]][6] |
25 | Debian 9 | armhf | [![debian-9-armhf][7]][8] |
26 | Debian 9 | arm64 | [![debian-9-arm64][9]][10] |
27 | OS X | amd64 | [![osx-amd64][11]][12] |
28 | OS X | i386 | [![osx-i386][13]][14] |
29 | Windows | amd64 | [![windows-amd64][15]][16] |
30 | Windows | i386 | [![windows-i386][17]][18] |
31 | CentOS | s390x (cs) | [![centos-s390x][19]][20] |
32 | Debian 9 | ppc64el (cs) | [![debian-9-ppc64el][21]][22]|
33 | AIX 6.1 | ppc64 (cs) | [![aix-ppc64][23]][24] |
34 | FreeBSD 12 | amd64 (cs) | [![freebsd-amd64][25]][26] |
36 _(cs) = community supported architecture_
38 [1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon
39 [2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64
40 [3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon
41 [4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/
42 [5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon
43 [6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/
44 [7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon
45 [8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/
46 [9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon
47 [10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/
48 [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon
49 [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/
50 [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon
51 [14]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/
52 [15]: https://jenkins.mono-project.com/job/z/label=w64/badge/icon
53 [16]: https://jenkins.mono-project.com/job/z/label=w64/
54 [17]: https://jenkins.mono-project.com/job/z/label=w32/badge/icon
55 [18]: https://jenkins.mono-project.com/job/z/label=w32/
56 [19]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x/badge/icon
57 [20]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=centos-s390x
58 [21]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el/badge/icon
59 [22]: https://jenkins.mono-project.com/job/test-mono-mainline-community-chroot/label=debian-9-ppc64el
60 [23]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64/badge/icon
61 [24]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=aix-ppc64
62 [25]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64/badge/icon
63 [26]: https://jenkins.mono-project.com/job/test-mono-mainline-community/label=freebsd-12-amd64
65 Compilation and Installation
66 ============================
71 Please see our guides for building Mono on
72 [Mac OS X](https://www.mono-project.com/docs/compiling-mono/mac/),
73 [Linux](https://www.mono-project.com/docs/compiling-mono/linux/) and
74 [Windows](https://www.mono-project.com/docs/compiling-mono/windows/).
76 Note that building from Git assumes that you already have Mono installed,
77 so please download and [install the latest Mono release](https://www.mono-project.com/download/)
78 before trying to build from Git. This is required because the Mono build
79 relies on a working Mono C# compiler to compile itself
80 (also known as [bootstrapping](https://en.wikipedia.org/wiki/Bootstrapping_(compilers))).
82 If you don't have a working Mono installation
83 ---------------------------------------------
85 If you don't have a working Mono installation, you can try a slightly
86 more risky approach: getting the latest version of the 'monolite' distribution,
87 which contains just enough to run the 'mcs' compiler. You do this with:
89 # Run the following line after ./autogen.sh
90 make get-monolite-latest
92 This will download and place the files appropriately so that you can then
97 The build will then use the files downloaded by `make get-monolite-latest`.
99 Testing and Installation
100 ------------------------
102 You can run the mono and mcs test suites with the command: `make check`.
104 Expect to find a few test suite failures. As a sanity check, you
105 can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
107 You can now install mono with: `make install`
109 You can verify your installation by using the mono-test-install
110 script, it can diagnose some common problems with Mono's install.
111 Failure to follow these steps may result in a broken installation.
116 Once you have installed the software, you can run a few programs:
118 * `mono program.exe` runtime engine
120 * `mcs program.cs` C# compiler
122 * `monodis program.exe` CIL Disassembler
124 See the man pages for mono(1), mcs(1) and monodis(1) for further details.
129 * `acceptance-tests/` - Optional third party test suites used to validate Mono against a wider range of test cases.
131 * `data/` - Configuration files installed as part of the Mono runtime.
133 * `docs/` - Technical documents about the Mono runtime.
135 * `external/` - Git submodules for external libraries (Newtonsoft.Json, ikvm, etc).
137 * `ikvm-native/` - Glue code for ikvm.
139 * `libgc/` - The (deprecated) Boehm GC implementation.
141 * `llvm/` - Utility Makefiles for integrating the Mono LLVM fork.
143 * `m4/` - General utility Makefiles.
145 * `man/` - Manual pages for the various Mono commands and programs.
147 * `mcs/` - The class libraries, compiler and tools
149 * `class/` - The class libraries (like System.*, Microsoft.Build, etc.)
151 * `mcs/` - The Mono C# compiler written in C#
153 * `tools/` - Tools like gacutil, ikdasm, mdoc, etc.
155 * `mono/` - The core of the Mono Runtime.
157 * `arch/` - Architecture specific portions.
159 * `benchmark/` - A collection of benchmarks.
161 * `btls/` - Build files for the BTLS library which incorporates BoringSSL.
163 * `cil/` - Common Intermediate Representation, XML
164 definition of the CIL bytecodes.
166 * `dis/` - CIL executable Disassembler.
168 * `eglib/` - Independent implementation of the glib API.
170 * `metadata/` - The object system and metadata reader.
172 * `mini/` - The Just in Time Compiler.
174 * `profiler/` - The profiler implementation.
176 * `sgen/` - The SGen Garbage Collector implementation.
178 * `tests/` - The main runtime tests.
180 * `unit-tests/` - Additional runtime unit tests.
182 * `utils/` - Utility functions used across the runtime codebase.
184 * `msvc/` - Logic for the MSVC / Visual Studio based runtime and BCL build system.
185 The latter is experimental at the moment.
187 * `packaging/` - Packaging logic for the OS X and Windows Mono packages.
189 * `po/` - Translation files.
191 * `runtime/` - A directory that contains the Makefiles that link the
192 mono/ and mcs/ build systems.
194 * `samples/` - Some simple sample programs on uses of the Mono
195 runtime as an embedded library.
197 * `scripts/` - Scripts used to invoke Mono and the corresponding program.
199 * `sdks/` - A new way of embedding Mono into Xamarin.iOS, Xamarin.Android and other products.
201 * `support/` - Various support libraries.
203 * `tools/` - A collection of tools, mostly used during Mono development.
208 Before submitting changes to Mono, please review the [contribution
209 guidelines](https://www.mono-project.com/community/contributing/).
210 Please pay particular attention to the [Important
211 Rules](https://www.mono-project.com/community/contributing/#important-rules)
217 To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new).
219 Please use the search facility to ensure the same bug hasn't already
220 been submitted and follow our
221 [guidelines](https://www.mono-project.com/community/bugs/make-a-good-bug-report/)
222 on how to make a good bug report.
224 Configuration Options
225 =====================
227 The following are the configuration options that someone building Mono
230 * `--with-sgen=yes,no` - Generational GC support: Used to enable or
231 disable the compilation of a Mono runtime with the SGen garbage
234 * On platforms that support it, after building Mono, you will have
235 both a `mono-boehm` binary and a `mono-sgen` binary. `mono-boehm` uses Boehm,
236 while `mono-sgen` uses the Simple Generational GC.
238 * `--with-libgc=[included, none]` - Selects the default Boehm
239 garbage collector engine to use.
241 * *included*: (*slightly modified Boehm GC*) This is the default
242 value for the Boehm GC, and it's the most feature complete, it will
243 allow Mono to use typed allocations and support the debugger.
246 Disables the inclusion of a Boehm garbage collector.
248 * This defaults to `included`.
250 * `--enable-cooperative-suspend`
252 * If you pass this flag the Mono runtime is configured to only use
253 the cooperative mode of the garbage collector. If you do not pass
254 this flag, then you can control at runtime the use of the
255 cooperative GC mode by setting the `MONO_ENABLE_COOP_SUSPEND` flag.
257 * `--with-tls=__thread,pthread`
259 * Controls how Mono should access thread local storage,
260 pthread forces Mono to use the pthread APIs, while
261 __thread uses compiler-optimized access to it.
263 * Although __thread is faster, it requires support from
264 the compiler, kernel and libc. Old Linux systems do
265 not support with __thread.
267 * This value is typically pre-configured and there is no
268 need to set it, unless you are trying to debug a problem.
270 * `--with-sigaltstack=yes,no`
272 * **Experimental**: Use at your own risk, it is known to
273 cause problems with garbage collection and is hard to
274 reproduce those bugs.
276 * This controls whether Mono will install a special
277 signal handler to handle stack overflows. If set to
278 `yes`, it will turn stack overflows into the
279 StackOverflowException. Otherwise when a stack
280 overflow happens, your program will receive a
283 * The configure script will try to detect if your
284 operating system supports this. Some older Linux
285 systems do not support this feature, or you might want
286 to override the auto-detection.
288 * `--with-static_mono=yes,no`
290 * This controls whether `mono` should link against a
291 static library (libmono.a) or a shared library
294 * This defaults to `yes`, and will improve the performance
295 of the `mono` program.
297 * This only affects the `mono' binary, the shared
298 library libmono.so will always be produced for
299 developers that want to embed the runtime in their
302 * `--with-xen-opt=yes,no` - Optimize code for Xen virtualization.
304 * It makes Mono generate code which might be slightly
305 slower on average systems, but the resulting executable will run
306 faster under the Xen virtualization system.
308 * This defaults to `yes`.
310 * `--with-large-heap=yes,no` - Enable support for GC heaps larger than 3GB.
312 * This only applies only to the Boehm garbage collector, the SGen garbage
313 collector does not use this configuration option.
315 * This defaults to `no`.
317 * `--enable-small-config=yes,no` - Enable some tweaks to reduce memory usage
318 and disk footprint at the expense of some capabilities.
320 * Typically this means that the number of threads that can be created
321 is limited (256), that the maximum heap size is also reduced (256 MB)
322 and other such limitations that still make mono useful, but more suitable
323 to embedded devices (like mobile phones).
325 * This defaults to `no`.
327 * `--with-ikvm-native=yes,no` - Controls whether the IKVM JNI interface library is
330 * This is used if you are planning on
331 using the IKVM Java Virtual machine with Mono.
333 * This defaults to `yes`.
335 * `--with-profile4=yes,no` - Whether you want to build the 4.x profile libraries
338 * This defaults to `yes`.
340 * `--with-libgdiplus=installed,sibling,<path>` - Configure where Mono
341 searches for libgdiplus when running System.Drawing tests.
343 * It defaults to `installed`, which means that the
344 library is available to Mono through the regular
347 * `sibling` can be used to specify that a libgdiplus
348 that resides as a sibling of this directory (mono)
351 * Or you can specify a path to a libgdiplus.
353 * `--enable-minimal=LIST`
355 * Use this feature to specify optional runtime
356 components that you might not want to include. This
357 is only useful for developers embedding Mono that
358 require a subset of Mono functionality.
359 * The list is a comma-separated list of components that
360 should be removed, these are:
363 Disables support for the Ahead of Time compilation.
366 Support for the Mono.Management assembly and the
367 VMAttach API (allowing code to be injected into
371 Disables COM support.
374 Drop debugging support.
377 Disables support for System.Decimal.
380 By default Mono comes with a full table
381 of messages for error codes. This feature
382 turns off uncommon error messages and reduces
386 Generics support. Disabling this will not
387 allow Mono to run any 2.0 libraries or
388 code that contains generics.
391 Removes the JIT engine from the build, this reduces
392 the executable size, and requires that all code
393 executed by the virtual machine be compiled with
394 Full AOT before execution.
397 Disables support for large assemblies.
400 Disables support for debug logging.
403 Support for Platform Invocation services,
404 disabling this will drop support for any
405 libraries using DllImport.
408 Removes support for MONO_IOMAP, the environment
409 variables for simplifying porting applications that
410 are case-insensitive and that mix the Unix and Windows path separators.
413 Disables support for the default profiler.
416 Drop System.Reflection.Emit support
418 * `reflection_emit_save`:
419 Drop support for saving dynamically created
420 assemblies (AssemblyBuilderAccess.Save) in
421 System.Reflection.Emit.
424 Disables support for AppDomain's shadow copies
425 (you can disable this if you do not plan on
429 Disables support for the Mono.SIMD intrinsics
433 Disables compilation for the SSA optimization
434 framework, and the various SSA-based optimizations.
437 * `--enable-loadedllvm`
439 * This enables the use of LLVM as a code generation engine
440 for Mono. The LLVM code generator and optimizer will be
441 used instead of Mono's built-in code generator for both
442 Just in Time and Ahead of Time compilations.
444 * See https://www.mono-project.com/docs/advanced/mono-llvm/ for the
445 full details and up-to-date information on this feature.
447 * You will need to have an LLVM built that Mono can link
450 * The `--enable-loadedllvm` variant will make the LLVM backend
451 into a runtime-loadable module instead of linking it directly
452 into the main mono binary.
454 * `--enable-big-arrays` - Enable use of arrays with indexes larger
457 * By default Mono has the same limitation as .NET on
458 Win32 and Win64 and limits array indexes to 32-bit
459 values (even on 64-bit systems).
461 * In certain scenarios where large arrays are required,
462 you can pass this flag and Mono will be built to
463 support 64-bit arrays.
465 * This is not the default as it breaks the C embedding
466 ABI that we have exposed through the Mono development
469 * `--enable-parallel-mark`
471 * Use this option to enable the garbage collector to use
472 multiple CPUs to do its work. This helps performance
473 on multi-CPU machines as the work is divided across CPUS.
475 * This option is not currently the default on OSX
476 as it runs into issues there.
478 * This option only applies to the Boehm GC.
482 * On Solaris and MacOS X builds a version of the Mono
483 runtime that contains DTrace probes and can
484 participate in the system profiling using DTrace.
486 * `--disable-dev-random`
488 * Mono uses /dev/random to obtain good random data for
489 any source that requires random numbers. If your
490 system does not support this, you might want to
493 * There are a number of runtime options to control this
494 also, see the man page.
496 * `--with-csc=roslyn,mcs,default`
498 * Use this option to configure which C# compiler to use. By default
499 the configure script will pick Roslyn, except on platforms where
500 Roslyn does not work (Big Endian systems) where it will pick mcs.
502 If you specify "mcs", then Mono's C# compiler will be used. This
503 also allows for a complete bootstrap of Mono's core compiler and
504 core libraries from source.
506 If you specify "roslyn", then Roslyn's C# compiler will be used.
507 This currently uses Roslyn binaries.
511 * This configures the Mono compiler to generate code
512 suitable to be used by Google's Native Client:
513 https://code.google.com/p/nativeclient/
515 * Currently this is used with Mono's AOT engine as
516 Native Client does not support JIT engines yet.
520 * Use this option to configure mono to run on WebAssembly. It will
521 set both host and target to the WebAssembly triplet. This overrides
522 the values passed to `--host` or `--target` and ignored what config.sub guesses.
524 This is a workaround to enable usage of old automake versions that don't
525 recognize the wasm triplet.
528 Working With Submodules
529 =======================
531 Mono references several external git submodules, for example
532 a fork of Microsoft's reference source code that has been altered
533 to be suitable for use with the Mono runtime.
535 This section describes how to use it.
537 An initial clone should be done recursively so all submodules will also be
538 cloned in a single pass:
540 $ git clone --recursive git@github.com:mono/mono
542 Once cloned, submodules can be updated to pull down the latest changes.
543 This can also be done after an initial non-recursive clone:
545 $ git submodule update --init --recursive
547 To pull external changes into a submodule:
550 $ git pull origin <branch>
552 $ git add <submodule>
555 By default, submodules are detached because they point to a specific commit.
556 Use `git checkout` to move back to a branch before making changes:
559 $ git checkout <branch>
560 # work as normal; the submodule is a normal repo
561 $ git commit/push new changes to the repo (submodule)
564 $ git add <submodule> # this will record the new commits to the submodule
567 To switch the repo of a submodule (this should not be a common or normal thing
568 to do at all), first edit `.gitmodules` to point to the new location, then:
570 $ git submodule sync -- <path of the submodule>
571 $ git submodule update --recursive
572 $ git checkout <desired new hash or branch>
574 The desired output diff is a change in `.gitmodules` to reflect the
575 change in the remote URL, and a change in /<submodule> where you see
576 the desired change in the commit hash.
581 See the LICENSE file for licensing information, and the PATENTS.TXT
582 file for information about Microsoft's patent grant.
584 Mono Trademark Use Policy
585 =========================
587 The use of trademarks and logos for Mono can be found [here](https://www.dotnetfoundation.org/legal/mono-tm).
589 Maintaining the Class Library Solution Files
590 ============================================
592 Mono now ships with a solution file that can be used to build the
593 assemblies from an IDE. Either by opening the topmost `net_4_x.sln`
594 file, or to by loading one of the individual `csproj` files located in
597 These are maintained by extracting the configuration information from
598 our Makefiles, which as of May 2016 remain the canonical location for
599 configuration information.
601 When changes are made to the Makefiles, a user would need to run the
602 following command to re-generate the solution files at the top level:
604 $ make update-solution-files