MonoGame on .NET Core

Getting MonoGame up and running on .NET core has never been easier thanks to the great work done by cra0zy in his MonoGame fork.

I know what you’re thinking. Is it stable? Well, I’ve been using MonoGame on .NET core for quite some time now in the MonoGame.Extended demos and as far as I can tell, it’s perfectly fine.

Motivation

I wrote this guide because everytime I start a new MonoGame project I want to get up and running quickly without having to think about it too much.

Prerequisites

For this tutorial I’m going to assume you’ve already installed the following tools and have some knowledge of how to use them:

Getting started

  1. Create a new github repository for your project (github has free private repos nowdays).
  2. Clone your repository to your local machine.
  3. Install the dotnet new template if you don’t already have it.

    dotnet new -i "MonoGame.Template.CSharp"
    
  4. Inside your repository folder create the new dotnet project.

    dotnet new mgdesktopgl
    
  5. Run your new project from within the same folder.

    dotnet run
    

    If all goes well, you’ll have a minimal MonoGame project that shows the classic Color.CornflowerBlue screen.

    CornflowerBlue on .NET Core!

Using Visual Studio

If you take a look at the files in the repository you’ll see a project file (.csproj) but no solution file (.sln) file. Simply open the .csproj file in Visual Studio and hit save. You’ll be prompted to save the .sln file and you can get on with your day.

What’s next?

At this point you can start working on your game but before you go here are some ideas to get you started.