Setting Up MonoGame

Setting Up MonoGame

We're ready to begin our adventure! Our first step will be to install the necessary software to start making games with MonoGame. Fortunately for us, this software is free! (All of the software I recommend is free, or I'll suggest a free alternative that could work almost as well.)

There will be two pieces to the installation process:

1. Install Visual Studio 2022 Community Edition (or another IDE).
2. Install MonoGame.

Installing Visual Studio

Before you can start programming in MonoGame, you will need to install the right development tools.

The minimum you need is the .NET Software Development Kit (SDK). With that, some command-line skills, and a text editor, you can do almost everything you want in .NET.

But that approach is a bit like assembling a car from parts before you drive it. There are some people who like it that way, but for most, what you really want is a program called an Integrated Development Environment, or an IDE. An IDE is a program that assembles all of the tools you need into a single easy-to-use application.

There are many IDEs you can choose from. I recommend either Visual Studio or Visual Studio Code for C# programming (like you will do in MonoGame). Visual Studio is far more feature-rich and easy to use than Visual Studio Code, but with two notable caveats:

1. Visual Studio does not work on a Mac or Linux (it is Windows-only), while Visual Studio code works in all of those places.
2. Visual Studio is only free if you're not a big company. If you have more than 5 Visual Studio users, make more than $1 million a year, or your company has 250+ computers, you'll need to pay for it. (But you also probably have the money for it in these circumstances. It's not terribly expensive, but it's also not free.)

If you don't fit into any of those categories, then you can use Visual Studio 2022 Community Edition. (And don't let that name scare you. You're allowed to use it for commercial purposes, including making games.)

If you don't want to pay for Visual Studio Pro or Enterprise and don't meet the criteria for Community, there are a few other options you can consider: Visual Studio Code is free and cross-platform but is not nearly as rich in features. Still, a lot of MonoGame users love it. Another option is Rider from JetBrains, which is cross-platform and well made but also costs money.

You can pick from any of these IDEs or any others that you find and want to try to make work, though I generally recommend starting with Visual Studio Community in the beginning because it is free, feature-rich, and well-supported.

The bulk of the content in these tutorials focuses on actual MonoGame programming, not how to use the IDE. These tutorials aren't about mastering Visual Studio.

However, I will show how to do certain tasks in Visual Studio, as there's a need. If you're using another IDE, the steps are usually pretty similar, and you can usually figure it out by just trying what makes sense. (If you encounter something truly puzzling, let me know, and maybe we can figure it out together.)

For now, I'll assume you're using Visual Studio. (If you're not, I'll also assume you know how to download and install the IDE of your choosing.)

Our first stop will be to install Visual Studio if you don't have it already. (If you've gone through my C# tutorials, you've already got this, and you can skip ahead.) Visual Studio is an Integrated Development Environment (IDE) provided by Microsoft that is used to make all sorts of software.

Downloading Visual Studio

All three of these options are available from here: https://visualstudio.microsoft.com/vs/

Choose the edition that makes the most sense for you (it is probably Community, at least to start, since that is the version that is free) and download the installer.

Once it is downloaded, run the installer. The installer will ask you which components and workloads to install. The "full" Visual Studio is massive, taking up many gigs of disk space. You probably don't need or want it all. I recommend starting small and adding components and workloads in as you need them. (You can always re-run the installer to change what is currently installed.)

I usually start by checking the box on the .NET desktop development workload and installing other things later, but you can pick anything you think you might use.

Registering

Eventually, Visual Studio will ask you to register. Doing so is free but requires giving them an email address. There are definite benefits to registering, but it can be skipped if you don't want to do so.

Installing MonoGame

The next step is to get MonoGame installed.

MonoGame used to be installed with an installer that you download from their website, but that has changed in recent versions.

The first step in getting MonoGame installed is to get the MonoGame project templates installed. There are several ways to do this, but the simplest is to use Visual Studio to get them installed.

Let's go through the steps to get this installed.

1. Open Visual Studio

Step 1 is simply running Visual Studio if the installer didn't launch it automatically. The installer may have put a shortcut on your desktop, but I usually find Visual Studio just by searching for it from the Start menu.

2. Continue without code

When Visual Studio starts, it is usually expecting you to pick a project you have previously worked on or start a new one. We are in the rare case where we want to do neither of those. Instead, look on the bottom right for a link button that says Continue without code and click on it.

ContinueWithoutCode.png

3. Add the MonoGame extension

On the top menu, go to Extensions > Manage Extensions. This will open a dialog window that will allow you to find and use Visual Studio extensions.

Go to the search bar on the right, search for "monogame".

This should give you a handful of results, one of which should be MonoGame Framework C# project templates.

MonoGameExtension.png

Find that extension and press the Download button.

It won't install until you close Visual Studio, so close Visual Studio. This will get the MonoGame extension to run.

4. Confirm your installation

Once the MonoGame extension installer finishes, run Visual Studio again and check that everything is installed as expected.

The easiest way to do this is to click on Create a new project on the launch screen (the same screen we clicked *Continue without code* last time).

If everything is installed, you should see the MonoGame templates in the list of all templates. If you don't see anything with MonoGame in the name immediately, then use the project types drop down on the far right to filter to just MonoGame. (If you don't see that item in the dropdown, it probably means it didn't get installed correctly.)

FindingTheMonoGameTemplates.png

If you're seeing templates with MonoGame in the name, as shown in the picture above, then things are working as expected, and you can proceed to the next tutorial!

Wrap Up

At this point, you should have an IDE like Visual Studio We'll move on to making our first MonoGame project in the next tutorial.


Troubleshooting.png Having problems with this tutorial? Try the troubleshooting page!