DesktopGL and .Net core

Hey, i was wondering if there is any support for .Net core for desktopGL projects and if there is any downside to switch to .Net core? If there’s a solution for .Net core i wonder how i would change my project from .Net framework to core?

Edit: I could be completely wrong but wouldn’t using .Net core make mono obsolet on Linux and Mac making extra steps like monokickstart unnecessary?

You can do a .Net core project with:

dotnet new --install MonoGame.Template.CSharp
dotnet new mgdesktopgl -o MyGame

That will create a new blank game called MyGame. From there, you can copy your current game’s source. And yes, it does mean you don’t need mono or monokickstart. To publish you will simply do:

dotnet publish -r linux-x64 -c release
dotnet publish -r osx-x64 -c release
dotnet publish -r win-x64 -c release

I had a runtime issue with a .Net Core DesktopGL app where my game’s Content property was null. I couldn’t figure it out, so I’m sticking with .Net Framework for now.

As far as I know, you’re right that .Net Core would eliminate the need for monokickstart.

The next step that I’m more interested in (especially since I’m focused on mobile first) is .Net Standard. To support multiple platforms (DekstopGL, Android, iOS, etc.) with shared common functionality, the two common methods are to use a Shared Project or a PCL. However “.NET Standard is the replacement for Portable Class Libraries (PCL).” https://docs.microsoft.com/en-us/dotnet/standard/net-standard#comparison-to-portable-class-libraries

This thread showed some community members had started looking into it, and suggested that the development may get more serious after the full release of .Net Core 3.0.

It’s a good idea to move your game code to a shared project. Then you reference the shared project from your various platform targets like .Net core, Android, etc.

I read that dot net core 3 will actually include winforms especially with system.drawing in there (which the guy in this review has noted and highlighted as well).
So that would be a benefit though im not sure how that is gonna work.

I was hyped for that until I realized it wasn’t going to be cross-platform. Makes it less less desirable to me.

I’ve been playing with this for an existing project but I’m having a problem with the content builder. I’ve got all my game code in a shared project. When I try to run my .NET core project, I get one of these errors, depending on which version of the MonoGame.Content.Builder is referenced:

3.7.0.4 - The “Version” parameter is not supported by the “GetMGCBTask” task.
3.7.0.8 & 3.7.0.9 - The “MgcbPath” parameter is not supported by the “GetMGCBTask” task.

The file/line points to this code inside MonoGame.Content.Builder.targets:


But I have no idea how to debug this further. Any thoughts?

Did you modify the template at all? What does your csproj look like?

OK… uh… I’m not sure why but now it works. I deleted these lines from my csproj:

  <ItemGroup>
    <MonoGameContentReference Include="**\*.mgcb" />
  </ItemGroup>

and it started working. Then I thought, “oh cool that’s the reason. Let me put those lines back and see it break again.” And I put them back and it still works. So yeah, that’s fun.

For reference, the project doesn’t have any content files, those are in the shared projects.

1 Like

Hello - I’m not sure if this thread is still active but I found a cool tutorial to setup a simple MonoGame project using .NET Core here

That one is a bit outdated. It uses the non official templates. I wrote a newer guide here: https://learn-monogame.github.io/getting-started/

Thanks Apostolique - will check this out!