WineHQ

Mono is an open-source and cross-platform implementation of the .NET Framework. Wine Mono is a fork of Mono that Wine uses to run .NET Framework applications.

Installing

From source

The source code can be obtained from a tarball in https://dl.winehq.org/wine/wine-mono/ or the development tree at https://github.com/madewokherd/wine-mono (TODO: Move the development tree to https://gitlab.winehq.org/groups/wine-mono).

From a source tree, you can use the "make dev" target to build Wine Mono and configure the current Wine prefix (default or as set by the WINEPREFIX environment variable) to use the build. The "make dev-setup" target will just configure the Wine prefix without building.

Shared Install

For packagers, and users with multiple prefixes, a shared install is recommended.

To create a shared install, download the appropriate binary tarball from https://dl.winehq.org/wine/wine-mono/ (or build it from source with "make bin") and extract it to the appropriate location.

Wine will search for Wine Mono in the following places (replacing 5.0.0 with the expected version from the version table below):

  • c:\windows\mono\mono-2.0. Extracting a tarball here is not recommended. If you want to install into a specific prefix, use the Prefix Local Install instructions below. It's only included in this list to make it clear that an installed .msi takes priority over the other locations.
  • The directory specified in HKEY_CURRENT_USER\Software\Wine\Mono string value "RuntimePath".
  • ${prefix}/share/wine/mono/wine-mono-5.0.0 or ${builddir}/../mono/wine-mono-5.0.0
  • /usr/share/wine/mono/wine-mono-5.0.0
  • /opt/wine/mono/wine-mono-5.0.0


When using a shared install, The "Wine Mono Windows Support" package must still be installed in the prefix. This is handled automatically on prefix update, so normally it shouldn't be a problem, but in some corner cases you might have to run "wineboot -u" to set this up after creating the shared install.

Prefix Local Install

Wine will automatically download and install the appropriate Wine Mono MSI on prefix update, so this shouldn't usually be necessary.

If you wish to use a different MSI installer than the one you'd get automatically:

  • Obtain the MSI file you wish to use, either from https://dl.winehq.org/wine/wine-mono/ or by running "make msi" in a build tree. It's possible you already have the one you want in ~/.cache/wine.
  • Run "wine uninstaller" and remove "Wine Mono Runtime" and "Wine Mono Windows Support" if you have them.
  • Run "wine path/to/wine-mono.msi"

The installer normally gives no feedback when it succeeds. You can run "wine uninstaller" again to check that you have the version you expect.

Versions

Wine Version Wine Mono Version
9.2 9.0.0
8.19 8.1.0
8.9 8.0.0
7.20 7.4.0
7.10 7.3.0
7.6 7.2.0
7.2 7.1.1
6.22 7.0.0
6.18 6.4.0
6.14 6.3.0
6.10 6.2.0
6.6 6.1.1
6.2 6.0.0
5.19 5.1.1
5.11 5.1.0
5.7 5.0.0
4.20 4.9.4
4.17 4.9.3
4.14 4.9.2
4.11 4.9.0
4.7 4.8.3
4.6 4.8.1
4.3 4.8.0
4.0-rc6 4.7.5
3.13 4.7.3
2.14 4.7.1
2.4 4.7.0
2.0-rc1 4.6.4
1.9.12 4.6.3
1.9.8 4.6.2
1.9.5 4.6.0
1.7.37 4.5.6
1.7.32 4.5.4
1.7.7 4.5.2
1.5.16 0.0.8
1.5.5 0.0.4

Building

For build instructions, see the readme at https://github.com/madewokherd/wine-mono

Debugging

The WINE_MONO_TRACE environment variable may be set as follows to trace calls within Mono:

    all                  All assemblies
    none                 No assemblies
    program              Entry point assembly
    assembly             Specifies an assembly
    wrapper              All wrappers bridging native and managed code
    M:Type:Method        Specifies a method
    N:Namespace          Specifies a namespace
    T:Type               Specifies a type
    E:Type               Specifies stack traces for an exception type
    EXPR                 Includes expression
    -EXPR                Excludes expression
    EXPR,EXPR            Multiple expressions

This option is the same as the --trace option in Mono.

Note that "All assemblies" includes the program itself and all libraries shipped with it. Mono is capable of tracing any .NET code. You probably should avoid the "all" trace if there might be proprietary code running in the process.

Activating any trace at all, even a bogus assembly name, will cause Mono to print out all exceptions as they occur. This can be useful, but it can also be misleading as some exceptions are perfectly normal.

Sometimes Mono's inlining can obscure the source of an exception, especially NotImplementedException. This can be worked around by setting MONO_INLINELIMIT=0.

Setting WINE_MONO_VERBOSE=1 will display the addresses of all JIT-compiled methods. Setting MONO_VERBOSE_METHOD=MethodName will display detailed information about the method's compilation, and break into the debugger if one is attached.

Documentation

Standard .NET namespaces and classes are documented at MSDN here: https://learn.microsoft.com/en-us/dotnet/api/?view=netframework-4.8.1

Test Suite

Wine Mono includes a test shell which can run tests from Mono and a few of its own. (TODO: Bring in tests from .NET Core projects?)

The tests can be built using "make tests" in the build tree (they will be found in wine-mono/tests) or downloaded from https://dl.winehq.org/wine/wine-mono/. The "make tests-zip" target will build a zip file for running outside the build tree.

To test a Wine Mono build from its source tree, use the "make test" target.

To run the full test suite in Windows or Wine, use run-tests.exe with no arguments.

Both of these methods use a default set of -skip-list, -pass-list, and -fail-list command-line switches to skip certain unreliable tests and to determine which tests are expected to pass or fail. Since these are only tested on Esme's build machine and GitHub CI, and even there they are unpredictable, expect some unexpected results. The -nodefaults switch will remove that default set of command-line switches, but it means running all tests even if they may crash or hang, or be incorrect.

Specific test names can be passed to run-tests.exe as arguments, for example:

$ wine tests/run-tests.exe System.Drawing # run all System.Drawing tests
$ wine tests/run-tests.exe x86.System.Drawing # run the System.Drawing tests only on x86
$ wine tests/run-tests.exe MonoTests.System.Drawing.GraphicsTest:Dpi_556181 # run one specific test

run-tests.exe can be used in the same way on native Linux Mono, or .NET on Windows. It can also be used with the native Mono inside a Wine Mono build tree with the mono-env script:

$ ./mono-env mono tests/run-tests.exe MonoTests.System.Drawing.GraphicsTest:Dpi_556181

Note that this particular Mono environment is only intended for building Wine Mono components, and may not accurately reflect the state of upstream Mono. Also, many of the tests only work in a Win32 environment.

Test source code can be found in tools/tests, mono/mono/tests, mono/mini, mono/mcs/class/*/Test, and mono-basic/vbruntime/Test. See https://www.mono-project.com/community/contributing/test-suite/ for information on Mono's tests.

C# interpreter

A C# interactive interpreter is also included with the tests, in the csharp directory.

Microsoft .NET

If you need to use Microsoft's implementation of the .NET Framework, the Microsoft runtimes can partly run on Wine. You can find tips and share comments with other users at the .NET AppDB page.

You can install the appropriate version of Microsoft's .NET runtime (dotnet35, dotnet30, dotnet20, or dotnet11) through winetricks. Be aware though, that your .NET application still might not work (at least not yet), and Microsoft's .NET runtimes are not free software so be sure to read the EULA before accepting. Wine Mono, on the other hand, is free software and probably a better choice if it works with your application.

.NET Core and .NET 5.0 and later are different from .NET Framework 4.x and earlier. They are no longer implemented as an OS component, and as such they can work just fine alongside Wine Mono, or alongside earlier .NET Framework versions. Applications relying on .NET Core or 5+ will usually include the runtime, meaning that it won't be necessary for users to install it, but the runtime installers should also work fine.

Wine Mono does not make any attempt to implement or replace .NET Core/5+, nor are there any plans to do so. The architectures are very different, and there hasn't been demand for a .NET Core/5+ replacement.


This page was last edited on 10 February 2024, at 16:31.