User Tools

Site Tools


Monogame with .NET 6.0.

Monogame is a brilliant tool for developing games with many years proving it still works. It is actively developed and several projects are based on monogame, to name one.

Xna, or Monogame, has a long history which makes it sometimes hard to find up-to-date examples. With these pages and its github-repository, I try to increase the flora of modern examples.

Despite the name of the project being 'ShootThemAll' there is no shooting, none at all. Shooting is not really the target of this project. Instead, I deliver a few short examples to get you started.

ShootThemAll is written in C# using Visual Studio 2022, with .NET 6. My intention was to prove it works fine with the latest version of VS and .NET.

The project can be found at the excellent Github site. The repository's url:

Source of inspiration

This code is rebuilt from the great NeonShooter demo by SimonDarksideJ, found here:

First setup

  • Install Visual Studio. I use Visual Studio Community 2022.
  • You must install .NET Core 3.1 Runtime (LTS) for monogame to compile.

Download versions of ShootThemAll

Each version can be found as a git tag, making it easy to get started if you are new to Monogame. Just click the tags link, select a version and download the zip file.

Unpack the zip file and open the ShootThemAll.sln file in Visual Studio. Build and run.

Version 1.0

This is the minimum amount of code for a Monogame window in .NET 6.0. It is just a black window.

The beauty of nugets

Nugets are the blessing of C# as it makes it so easy to add other people's code to your project!

This project makes use of two nugets:

  • MonoGame.Framework.DesktopGL - This is “monogame”. I prefer the opengl version just because I have been working with opengl.
  • MonoGame.Content.Builder.Task - Great tool which auto-compiles your artwork.

Our code

The code reside in two files, and here they are:


Class Program is the starting point for the windows application. The constructor creates an instance of the ShootThemAllGame class and calls Run().


Class ShootThemAllGame derive from the monogame Game-class. In the constructor, we create a GraphicsDeviceManager connecting to 'this' game-object. (It's a window).

Running the example opens a black monogame window.

monogame.txt · Last modified: 2022/04/02 02:34 (external edit)