MonoGame for MonoDevelopor
MonoGame for Xamarin Studio.
*.config
files from assemblies/Linux/
into the colorsquare/
sources directory. Note: mpack
files are zip
archives.Total size: < 5 MB
apt-get install
apt-get install libmono-system-drawing4.0-cil mono-dmcs libopenal1 libsdl1.2debian libsdl-mixer1.2
Total size: approx. 16 MB for Mono, 0.5 MB for OpenAL, and 7.5 MB for SDL and SDL_mixer (on a slim Ubuntu Precise, with X.Org already installed)
cd
into the sources directory on the command line
cd colorsquare
dmcs -r:MonoGame.Framework.dll -target:winexe -out:colorsquare.exe *.cs
mono colorsquare.exe
mcs
compiler in Mono ≥ 2.11If you choose to compile Mono from source, note that starting with Mono version 2.11 a new unified compiler mcs is available. It replaces all previous runtime specific compilers.
When using one of these recent versions, the compile command for the example sources (C# 4.0) is:
mcs -sdk:4 -r:MonoGame.Framework.dll -target:winexe -out:colorsquare.exe *.cs
If you hit a DllNotFoundException or TypeLoadException, double-check that you have installed all the required media libraries (SDL, SDL_mixer, and OpenAL) and copied all the MonoGame DLL
and *.config
files to the same directory as colorsquare.exe
. If you're still having trouble, you can read more about what the config
files do (https://www.mono-project.com/docs/advanced/pinvoke/dllnotfoundexception/), and then try running with more debugging information:
MONO_LOG_LEVEL=debug mono colorsquare.exe
The particularly tricky cases are when a DLL fails to load because one of the DLLs on which it depends can't be found. For example, if OpenTK.dll
is missing, the error message might look like:
Unhandled Exception: System.TypeLoadException: A type load exception has occurred.
at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
But setting MONO_LOG_LEVEL=debug
exposes the real problem (OpenTK could not be loaded):
Mono: Assembly Loader probing location: '/colorsquare/OpenTK.exe'.
Mono: Assembly Loader probing location: '/usr/lib/OpenTK.exe'.
Mono: The following assembly referenced from /colorsquare/MonoGame.Framework.dll
could not be loaded:
Assembly: OpenTK (assemblyref_index=2)
Version: 1.1.0.0
Public Key: bad199fe84eb3df4
The assembly was not found in the Global Assembly Cache, a path listed in the MONO_PATH environment variable, or in the location of the executing assembly (/colorsquare/).
If you move the MonoGame DLLs to a subdirectory, you will need to tell mono
where to find them.
MONO_PATH=/path/to/MonoGameLibs/ mono colorsquare.exe
Submit a comment or correction
10 Feb 2019 | Update some of the links |
29 Jun 2013 | Posted |