MonoGame setup with VSCodium + .NETCore + Samsung Debugger (Tutorial)

UPDATE: If you end up having building issues with your sound files, there is a fix at the end of this tutorial!

Hi guys, so, I’m an Ubuntu user and I was suffering to deploy my game using MonoDevelop, so I found out about dotNet publish, VSCodium and Samsung dotNet debugger, so I’m here to post a tutorial about how to setup a MonoGame project on your Linux (don’t need Monodevelop!):

Tools we’re going to install:

  • VSCodium. (An open-source VSCode, but without trackers and telemetry)
  • MonoGame;
  • .NETCore;
  • Samsung .NETCore Debugger (An Open-Source NETCore debugger)

First let’s follow these steps:

1- Install the latest mono package:
https://www.mono-project.com/download/stable/

2 - Install the latest MonoGame [to get the Pipeline Tool]:
https://www.monogame.net/downloads/

3 - Install the latest .NETCore [3.1] on your linux, follow these steps::

4 - Install VSCodium following these steps here:

5 - Once they are finally installed, go to your terminal and type:

dotnet new --install MonoGame.Template.CSharp

(this will add monogame template to dotnet core)

6 - cd to your favorite project folder and type:

dotnet new mgdesktopgl -o MyGame

(MyGame can be called your project)

7 - Go to your already created game project folder by typing

cd MyGame

then type

codium .

VSCodium will open, go to Extensions Tab (Ctrl+Shift+X) and install these 3 extensions:
C#
C# Extensions
C# FixFormat

Once everything above is installled, now we have to install the Debugger. Once the default debugger is only available on Visual Studio and VSCode (not the open-source VSCodium), we have to install the open-source .NETCore Debugger from Samsung. Now follow these steps:

1 - Download the netcoredbg-linux-master.tar.gz (not the armv7l one) file here:

2 - Extract it and copy the netcoredbg folder to your home/(your_username)/bin.

3 - Go to your game project folder and open the launch.json file located inside .vscode folder, on /your_proj_name/.vscode/launch.json. You can edit this file inside VSCodium as well, or on your favorite editor.

4 - Once launch.json is opened, you can see if code is like this one and you can do the changes:

Here how it looks mine:

{
   // Use IntelliSense to find out which attributes exist for C# debugging
   // Use hover for the description of the existing attributes
   // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
   "version": "0.2.0",
   "configurations": [
        {
            "name": ".NET Core Launch (console)",
            "type": "coreclr",
            "request": "launch",
            "preLaunchTask": "build",
            // If you have changed target frameworks, make sure to update the program path.
            "program": "${workspaceFolder}/bin/Debug/netcoreapp3.1/(your_game_folder_name).dll",
            "args": [],
            "cwd": "${workspaceFolder}",
            // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
            "console": "internalConsole",
            "stopAtEntry": false,
            "internalConsoleOptions": "openOnSessionStart",

            "pipeTransport": {
                "pipeCwd": "${workspaceFolder}",
                "pipeProgram": "bash",
                "pipeArgs": ["-c"],
                "debuggerPath": "/home/(your_username)/bin/netcoredbg/netcoredbg",
                "quoteArgs": true
            }
        },
        {
            "name": ".NET Core Attach",
            "type": "coreclr",
            "request": "attach",
            "processId": "${command:pickProcess}"


        }
    ]
}

Remember that you have to change “your_username” to your real username on: ( without the ( ) )
``“debuggerPath”: “/home/your_username/bin/netcoredbg/netcoredbg”`

And also change the line (your_game_folder_name) to the name of your game folder name ( without the ( ) )
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/(your_game_folder_name).dll"

Once finished the changes, save it and you now will be able to Debug through Samsung NetCore on VSCodium! Press F5 to test it out!

And the last, but not least, once you finish a demo of your game (or the full game), it’s time to publish it, so you can have your fans testing your game. On Linux we can deploy to all 3 desktop platforms: Linux, Windows and Mac.

So just go to Terminal on VSCodium by clicking on Terminal -> New Terminal and choose between these 3 commands:

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

All builds will then be ready and can be found on your_game_folder/bin/Release/netcoreapp3.1

Well, there you are! A complete open-source experience for a linux user :slight_smile: Hope it works for you as well!

Sources:


BONUS:
Now that you have NETCore 3.0+ installed, you can follow this tutorial to publish a single file exe [Win, Mac and Linux] from your game directly from your terminal:

Enjoy!

1 Like

Sorry for the double post, but I was finally able to fix the issue.

Once you did everything above and end up having building issues with mp3/ogg, sound files, aka “error MSB3073”, here is the fix:

Go to Terminal and type:
chmod +x /home/(your_username)/.nuget/packages/monogame.content.builder/3.7.0.4/build/MGCB/build/ffprobe

then:

chmod +x /home/(your_username)/.nuget/packages/monogame.content.builder/3.7.0.4/build/MGCB/build/ffmpeg

Go to Debug and see if it runs as it should. Mine was fixed and it’s perfect now :slight_smile: Hope that helps!

Source: Unexpected Failure while importing Wave files with de MGPipelineTool

is there any reason you want with vscodium instead of vs code? i’d rather use the native debugger because of the integration

i followed the guide, but i’m getting this error: “couldn’t fine a debug adapter descriptor for debug type ‘coreclr’ (extension might have failed to activate)” whenever i try to run f5 or ctrl+f5

Hi :slight_smile: Here you can see the main reason:

Strange… Couldn’t even find the error on google. Maybe it has something to do with the newest sdk [3.8]?

I can see that when we click on link of Monogame sdk I provided here on tutorial, it goes to latest 3.8 version. When I wrote this tutorial it was still 3.7.1: MonoGame 3.7.1.

I’ll try to make a clean install with 3.8 and if anything I’ll post here soon

Ah that might be the problem. I am doing a study at the moment and they recommended version 3.6, because the book was written with that version in mind. But then again, it was also written with windows and visual studio 2017 in mind, so…

Oh, I got it :] Most of monogame stuff I was able to learn is thanks to this channel: https://www.youtube.com/watch?v=r5dM0_J7KuY&list=PLV27bZtgVIJqoeHrQq6Mt_S1-Fvq_zzGZ

Regarding the sdk, I still need to migrate to 3.8, though. I know it’s not gonna be “that” easy, so when I have some spare time, I’ll do it and share here soon :slight_smile: