Compiling MonoGame WindowsGL programs on the command line

Download and unzip the minigame source files

Unpack the MonoGame DLLs to the sources directory

  1. Download MonoGame for MonoDevelop or MonoGame for Xamarin Studio.
  2. Unpack the DLLs from assemblies\WindowsGL\ into the colorsquare\ sources directory. Note: mpack files are zip archives.

Total size: < 5 MB

Or install MonoGame for Visual Studio, and copy the DLLs from Program Files\MonoGame\v3.0\Assemblies\WindowsGL\ to the sources directory.

Install OpenAL

  1. Download the OpenAL Installer for Windows.
  2. Install.

Alternative minimal installation

Copy just the following DLLs into the sources directory:

Total size: < 600 KB

cd into the sources directory on the command line

cd colorsquare

Compile the C# sources

C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe /r:MonoGame.Framework.dll /target:winexe /out:colorsquare.exe *.cs

Or, put csc.exe on the %PATH% first, and then compile the C# sources:

set PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319\
csc /r:MonoGame.Framework.dll /target:winexe /out:colorsquare.exe *.cs

Run

colorsquare

Alternative to .NET: install Mono for Windows

  1. Download Mono for Windows, Gtk#, and XSP.
  2. Install. Note: only Mono is required for this example. GTK, GTK#, and XSP are not needed.

Installed size: < 270 MB

Compile the C# sources

"C:\Program Files\Mono-2.10.9\bin\mcs.bat" -sdk:4 -r:MonoGame.Framework.dll -target:winexe -out:colorsquare.exe *.cs

Run

"C:\Program Files\Mono-2.10.9\bin\mono" colorsquare.exe

Found a mistake?

Submit a comment or correction

Links

Command-line Building With csc.exe
Working with the C# 2.0 Command Line Compiler

Updates

10 Feb 2019 Update some of the links
23 Apr 2013 Posted