[DesktopGL + dotnet publish] Console window showing

Hello fellow devs.

I’m facing a small hurdle and hoped to get some advice from you.

Here’s the setup :

  • Monogame 3.8
  • DesktopGL
  • .net core 6
  • self contained publishing, from Linux

Things are working fine on Linux and Windows, it’s almost perfect.

However, I noticed that when running the build result under Windows, the game is launched with a command console, and that’s not what i want.

In order to solve that, I published the game from Windows, and it works as expected, no console displayed.

I’m not very keen on having to boot on Windows in order to publish my game, so I was wondering if there were a better and easiest way to proceed.

Thanks in advance.

Edit : clarifying

Check your csproj, you should change the output type to WinExe:

<OutputType>WinExe</OutputType>

Thanks for your answer.
It’s already the case.

As I stated, publishing for Win from Win gives the expected result, where publishing for Win from Linux, leads to a console window displayed.

As a matter of fact, I tested the official monogame cornflower blue template, .net3.1 and the results are the same.

In that case you’re running into

It will be fixed in .NET 7 apparently:

1 Like

Thanks for tracking this down :slight_smile:
Indeed I was sure it was a dotnet issue, but i was expecting someone to have a workaround.

Looks like I’ll have to publish using windows until then.

One reason I didn’t notice this before was that I release my games on itch.io and I launch them through the itch launcher. Apparently the launcher does something because the consoles don’t show.

There might be another workaround using rcedit. You can see this dirty hack I did here to add an icon to my app under Linux:

Maybe there’s an option to also hide the console with rcedit. https://github.com/electron/rcedit

1 Like