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 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!