MonoGame.WpfCore - Embed MonoGame in WPF using .NET Core 3.0

MonoGame.WpfCore

Simple. Modern. Customizable.

MonoGame.WpfCore is a super simple way to embed MonoGame into WPF applications.

It’s a minimal, low dependency way to create your own MonoGame based editor using .NET Core in Visual Studio 2019.

Great tools help make great games.Spend as much time on tools as possible.

  • John Romero – id Software

Over the years several attempts have been made to embed MonoGame into WPF applications. Most of them are complicated, outdated and no longer work with the latest version of MonoGame.

For these reasons, I made sure it’s as simple and robust as possible:

  • The WPF project references the official MonoGame.Framework.WindowsDX NuGet package.
  • All of the files required to get MonoGame working in WPF are included in the project template.
  • After the project is created, everything can be customized to suit your needs.

MonoGame.WpfCore is built as a dotnet new template. This makes it possible to get a new MonoGame WPF application up and running in minutes with a few simple steps:

  1. Install .NET Core 3.0 (if you haven’t got it already)

  2. Clone the github repository

  3. Install the template:

    dotnet new -i MonoGame.WpfCore\
    
  4. Create the new project.

    mkdir MyLevelEditor
    cd MyLevelEditor
    dotnet new monogamewpf
    

Full instructions are in the README.

Of course, nothing new is perfect. If you find any problems please raise issues on github.

5 Likes

Very cool and looking forward to trying it.

1 Like

Any news on it? You currently targeting net472 but not netcoreapp3.0 (under netcoreapp3 it does not compile)

Correct. We have to target net472 because MonoGame itself is not compatible with .NET Core. There’s currently no way to get this to work fully under .NET Core yet as far as I’m aware.

Most other issues related to getting things to compile can usually be resolved by making sure you’ve got the latest version of Visual Studio installed.

I just tested and confirmed it works with:

If you’re having any other issues please post them on github.

1 Like