Get started

This guide will give you the steps to install MonoGame, get a basic project setup, and build an output that you can publish.

Install

  1. Get the .NET Core 3.1 SDK.
    • Test that dotnet is installed correctly:
    dotnet --version
    
  2. Get the MonoGame templates:
    dotnet new --install MonoGame.Templates.CSharp
    
  3. Get the MonoGame Content Pipeline:
    dotnet tool install --global dotnet-mgcb-editor
    mgcb-editor --register
    

Create a new game

Replace MyGame with your game’s name in the following two command:

dotnet new mgdesktopgl -o MyGame
cd MyGame

Run

dotnet run

Publish

You can publish on Windows, Mac, and Linux using:

dotnet publish -c Release -r win-x64 -o artifacts/windows
dotnet publish -c Release -r osx-x64 -o artifacts/osx
dotnet publish -c Release -r linux-x64 -o artifacts/linux

You’ll find the output in:

artifacts/windows
artifacts/osx
artifacts/linux

You can zip those folders to share your game.

Bug

In MonoGame 3.8.0.1641 there’s a bug that prevents you from compiling your game if you have a space anywhere in the build path. There is an easy manual fix thankfully. Apply the fix found here. Find the global package location for your system. Edit the .targets file at: ~/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build/MonoGame.Content.Builder.Task.targets. Surround $(MGCBPath) with " on line 140:

Command="$(DotnetCommand) "$(MGCBPath)" $(MonoGameMGCBAdditionalArguments) /@:"%(ContentReference.FullPath)" /platform:$(MonoGamePlatform) /outputDir:"%(ContentReference.ContentOutputDir)" /intermediateDir:"%(ContentReference.ContentIntermediateOutputDir)" /workingDir:"%(ContentReference.FullDir)""

Read more

You can read more getting started info from the official MonoGame docs.


Now that you have a project, the next step is to setup a development environment. Developing with Visual Studio Code.

Edit this page on GitHub