Getting a working setup for monogame

For college, I used Visual Studio 2019 (on windows) and got the templates/downloaded plugins/clicked on what i was told to click on at the start, and sort of just went with the flow.
But once I was inside, the pretty “Game1” life started, and I really enjoy it :slight_smile:

But i dont enjoy windows. So i moved back to linux for my mental safety, but this remote desktop work is not working for me, either.

I know VScode is fully supported on linux, but I had a hard time- as in, failed spectacularly- getting it working with monogame. Also I am somewhat aware that its more of a text editor than an IDE, and Ill probably feel that when i start to use it? I did use auto complete and stuff plenty. Bottom line- I havent tried it yet.

I figured that if I can get to the point of opening my repo file and clicking on the .sln file of X project opens the game on an IDE and I can click “run” and it works, I should be able to figure out the rest, as that would mean all compatibility stuff is cleared. I think.

So how can I get a work flow as I had in windows- on linux?
I do see that monogame is supported for linux but I really dont see how to make it click.

I have read plenty of docs and wiki’s, but I think its something more simple that I am missing.

Any advice would be greatly appreciated , thanks!

vscode is what I use. If you want some templates with the right setup, you can use mine:

dotnet new --install Apos.Framework.Simple.CSharp

then:

dotnet new Apos.Framework.Simple -o MyGame

You’ll be able to press F5 in vscode to run the game and you can put breakpoints.

To get the MonoGame pipeline:

dotnet tool install --global dotnet-mgcb-editor
mgcb-editor --register

Note that to run those commands, you need the dotnet SDKs: https://dotnet.microsoft.com/download

I use the 3.1 SDKs since that’s the LTS release.

You’ll know dotnet is installed correctly if you run:

dotnet --version

You can view my template’s source here: https://github.com/Apostolique/Apos.Framework/tree/master/Source/Simple.

1 Like

thank you so much for your reply.

dotnet --version returns 5.0.104.

Even tho i really honestly dont know what your first 2 commands do or what a

is, I done them anyway and without any issues.

Well, I mean, It LOOKS like whenever running that line

with a different name at the end, will make a project template of said name with a slightly changed monogame setup. So you have changed “Game1” to “GameRoot” and you have only 3 folders for the game content, the game code and platform compatibility(?).
What ever it did, I press F5/run and I get errors- I dont see any cornflower blue in your code, so is there even a default game? if not, that may be the reason it does not work.
Either way, whilst i dont mind using what seems to be a sensible starting point, I wanna be able to finish my current projects.

on another note, I did get the pipeline installed, but when I do mgcb-editor --register it tells me its an unknown command. When trying dotnet tool install --global dotnet-mgcb-editor again, it tells me its already installed.

Opening up VScode, nothing seems to have changed. I can see, edit and otherwise look at my code, but running is not possible and it sorta feels messy anyway.

I may as well open my project in atom to edit it in a nicer environment :stuck_out_tongue:

My template sets the default background color to black.

I’m guessing your issue is that you don’t have the 3.1 SDK like me. https://github.com/Apostolique/Apos.Framework/blob/master/Source/Simple/Platforms/DesktopGL/DesktopGL.csproj#L5

Open Platforms/DesktopGL/DesktopGL.csproj and edit the TargetFramework line. Set the value to net5.0:

<TargetFramework>net5.0</TargetFramework>

For the pipeline tool, I’m guessing you don’t have $HOME/.dotnet/tools added to your path. This is where it will get installed. You can read more about that here: https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools.

You can test if the game runs without vscode by running:

dotnet run -p Platforms/DesktopGL/DesktopGL.csproj

I did the edit, but still not working. I do have ~/.dotnet.tools and indeed there is mgcb-editor as an executable there, but executing it does absolutely nothing lol. Just no response.
That said… Since trying to execute it my power button light has not blinked.

Doing

tells me to fix build errors and try again.

That all said, a reboot and across VScode, the terminal and Rider is now all one simple error code:

Build FAILED.

/home/myname/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build/MonoGame.Content.Builder.Task.targets(138,5): error MSB3073: The command "dotnet /home/myname/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build/../tools/netcoreapp3.1/any/mgcb.dll /quiet /@:"/home/myname/FATLOVE/Content/Content.mgcb" /platform:DesktopGL /outputDir:"/home/myname/FATLOVE/Content/bin/DesktopGL/Content" /intermediateDir:"/home/myname/FATLOVE/Content/obj/DesktopGL/Content" /workingDir:"/home/myname/FATLOVE/Content/"" exited with code 150. [/home/myname/FATLOVE/Platforms/DesktopGL/DesktopGL.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.78
The terminal process "dotnet 'build', '/home/myname/FATLOVE/Platforms/DesktopGL/DesktopGL.csproj'" terminated with exit code: 1.

and its super consistent. Weather its one of my projects or your black screen or a game i know shouldnt run without errors before build :stuck_out_tongue:

i made one of your projects called FATLOVE for clarity.

any ideas?

Does your name happen to have a space inside it? If so, that’s the issue. In the current released MonoGame version, there’s a bug where you can’t have a space in your path.

That bug has been fixed in the develop branch.

You can manually fix it in your local files.

Find your local nuget packages: ~/.nuget/packages more info: https://docs.microsoft.com/en-us/nuget/consume-packages/managing-the-global-packages-and-cache-folders

The task package should be here: ~/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build

Apply this fix: https://github.com/MonoGame/MonoGame/commit/886b639294a357e11e8afd601c4fe1dac9ad6ef2.

oh i wish it did. my name is just 6, normal letters

I suppose I wouldn’t mind doing a full wipe and re-install of anything mono, Rider, VScode, monogame .NET related? Wouldnt know where to start with that though

Just for the sake of it, you could if you wanted comment out the task from the csproj:

<!-- <PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.0.1641" /> -->

It won’t really fix the true issue, but at least you should get a window to show up.


Maybe the fix I wrote in Getting a working setup for monogame - #6 by Apostolique would still fix your issue somehow? The fact you don’t have a space anywhere in the project path is really troublesome. It might mean there’s another bug in the task project that we didn’t fix yet?

commenting that out, saving then pressing f5 to run, I get:
“Configured debug type coreclr is not supported.”
which seems familiar- It was saying something about coreclr earlier.

ill look at your fix now.

Did dotnet run work though?

dotnet run tell me that no project exist and that i should make sure /home/me has a project.
I do have projects, such as FATLOVE still there, though.

I run it with --project and a direct path to both a repo of a game and to that games’ .sln.
When I do that, (dotnet run --project /path/to/project/project.sln), it comes with the same error as before. At least thats consistent

Did you figure it out in the end?