I'm trying to install MonoGame for mac and VS code. I followed the instructions at https://docs.monogame.net/articles/getting_started/1_setting_up_your_development_environment_macos.html, but I am stuck at one place. I have the monogame editor .mpack file, but can't upload it to VS code for some reason. I did extensive research but can't find any answers. What should I do?
-
Visual Studio Code != Visual Studio – ProgrammingLlama Mar 10 '22 at 02:29
-
Perhaps try [this guide](https://www.reddit.com/r/monogame/comments/cst49i/the_ultimate_guide_to_getting_started_with/). – ProgrammingLlama Mar 10 '22 at 02:30
-
Sorry, I didn’t make the question clear enough. I understand VS code != Visual Studio, that’s why I’m asking this question. I just need to figure out why I can’t upload a .mpack extension that is on the Monogame Mac starterpack, and for some reason VS code won’t let me install it. – DarthEggo Mar 10 '22 at 02:51
-
I might be wrong, but isn't .mpack a Visual Studio thing, not a Visual Studio Code thing? – ProgrammingLlama Mar 10 '22 at 03:46
-
Yep, you are right. I tried converting to a .vsix, doesn’t work on Mac. Thanks for trying to help though :) – DarthEggo Mar 10 '22 at 06:24
1 Answers
The "normal" Mac install instructions and files are only for use with Visual Studio.
Install using CLI
Please note these instructions are designed for Intel Macs(x64), but should work on Apple Silicon devices(ARM) with .Net6
.
You can roughly follow the Linux install instructions.
Install Dot Net Core 3.1 for the Mac. or .Net6
Install VS Code.
You may need to reference this question on Terminal paths for
code
. Something similar may need to be done below for thedotnet
command.a. Install the C# extensions:
code --install-extension ms-dotnettools.csharp
(Optional) Install Mono. Required for some consoles and Android targets(Frameworks 4.5 and 4.7). See here for compatability.
Open a terminal window. Run the following line, either the OS or from VS Code:
dotnet new --install MonoGame.Templates.CSharp
The next two lines may be Linux specific so ignore any uncorrectable errors.
dotnet tool install --global dotnet-mgcb-editor
mgcb-editor --register
At this point, you should be able to create a new CLI project folder from the templates:
cd /path/togame/parent
dotnet new mgdesktopgl -o MyGame
Open the folder in VS Code.
Review the projectname.csproj file:
Note the TargetFramework
line:
<TargetFramework>netcoreapp3.1</TargetFramework>
or
<TargetFramework>net6.0</TargetFramework>
Some targets require a different TargetFramework
, like net47
or net45
as provided by Mono.
See Microsoft's .Net versioning page for more information.
A couple of additional helpful CLI commands to run from the folder with the .proj
file; Taken from this list:
dotnet restore
Update all NuGet Packages
dotnet clean
Remove all output files
dotnet build
compile
dotnet run
execute the program
-
Please let me know of any corrections I need to make, and the version of Mac you are running. – Mar 11 '22 at 20:07
-
Preliminary reports, https://github.com/MonoGame/MonoGame/issues/7632 , suggest that the net6.0 versions of the nuget packages are available. – Mar 11 '22 at 22:21