[SOLVED] Help getting starting with MonoGame

Hi all, I’ve been wrestling with trying to install MonoGame and get it up and running for over three hours now, I’m hitting a brick wall and all my googling has just led to trying things over and over with no luck. I don’t have a background in VS so much of this is new to me, so please if you’re going to suggest installing things please specify what you mean - whether its a CMD prompt thing, a PM thing in Visual Studio, etc. I’m trying to get a handle on what all these means, but honestly all I want to do is being able to start a new project in VS with a MonoGame template and have it work. I have no idea why this is so difficult. Here is what I’ve done so far:

As per the ‘Getting Started Guide’ I installed Visual Studio 2019 and then installed the extension/project templates, and used dotnet to install the MGCB Editor. From here, starting a new project led to this error:
Annotation 2021-01-10 105619

I don’t really know what that means, so I googled it and found a bunch of people having similar issues, many pointed to the fact that the templates don’t work in 2019 (despite the getting started guide specifically asking for 2019). They started you needed templates from 2017, and a few members provided them. The first time I did this, I got the same errors, and a future user stated you needed to EDIT the template files to make them work. Somebody provided the edited files, which I then tried placing in the correct directory. This led to this error:

Annotation 2021-01-10 110015

This led to much less online results, and I wasn’t able to follow the error so I figured I’d give up on VS2019 and install VS2017. Unfortunately, after installing and restarting, this led to the same error, so I tried to dig deeper.

As it was discussing Content Builder Targets and MSBuild, I googled these things and found a few people mentioning MSBuild needing to be installed, and on the MonoGame page it does have Content Builder Targets packages that you can download/install with dotnet, despite it not mentioning anywhere I should do so. I figured maybe it should have been included in VS but wasn’t due to my selections, so I did this. I ran the command:

dotnet add package MonoGame.Content.Builder.Task --version 3.8.0.1641

It went through and apparently installed things, but I still dont see a Monogame folder in the MSBuild directory. I tried running the Nuget commands instead to install it, but this gives me a “solution not open” error which I’m assuming is because I don’t have a project open. But I can’t open a project because I get the above error.

I’m sure the solution is relatively simple, but I’ve tried installing vcredist from 2012 and 2013 as per an online page suggestion, tried swapping folders around, opening files to edit them and reopen them, reinstall VS2019 and VS2017, I really don’t have any idea what to do next and I’ve run out of goggle page solutions to try. Any help would be greatly appreciated. I’m at a loss for words over how difficult it has been to try and use MonoGame.

Ugh Sorry to hear! Hours of detective work just to get started doing something basic is no fun! I remember also having issues with VS19 and templates for an older versions of MG but as of 3.8 it’s been smooth sailing for me. Although I’m currently learning about how to do it from source which isn’t terribly well documented.

I’ll see if I can give you some input tomorrow if nobody beats me to it but for now welcome to the community !
Happy coding

1 Like

Hi @Riot, Welcome to the Community!

Can you point to which guide you have been following originally?

Happy Coding!

1 Like

Hi Mr.Valentine! Thanks! So the guide I used to begin with when I was first installing VS2019 and MonoGame using the inbuilt packet manager or however it’s referred to was this guide here.

I also went ahead and uninstalled and found an older guide for an older version of MG that used an actual windows installer, which was a little less confusing to my noob brain, but still had no luck due to the second error that occurs (in 2017) and the first error which occurs (in 2019). That guide was here.

The main crux of the issue from reading the error over and over and checking the folders it’s pointing to, is that I don’t have a MonoGame folder inside my MSBuild directory. I don’t know how to get the contents of that folder to place in there, and I’m not sure which step I missed that places the contents of that folder in there to begin with. I assume it’s not too complicated to fix, but I’m just not familiar enough with VS and all of its dependencies as of yet to completely grasp it. This is an error other than the template error that occurs in 2019, I’m assuming.

I appreciate any help regarding this since I’d love to dive in with MG.

A


Are you the admin user on your computer or are you using some school computer?

B



Did you find this part ok?

C


And did you install these?


image

D


And have you run this?

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

E


You can ignore the Optional part on the page.
EDIT
If you did this, I think you may have corrupted something and can try repairing VS or reinstalling it…



Let me know.

1 Like

A. Yes, I’m the administrator on this pc, just my personal PC in this case.

B. I did find the MonoGame project templates in the extensions (which I mistakenly referred to as the package/packet manager, sorry too much unity) and they installed fine once VS was closed (they don’t seem to install unless you close VS).

C. I did install all of those with the exception of Mobile development with .NET purely because I have no interest in developing for mobile platforms. I assumed that wouldn’t cause any issues but upon reinstalling I can try and include it and hope for the best.

D. I did use the CMD prompt to install the mgcb editor, as well as register it. No errors seemed to arise from this process.

I’ve also tried repairing VS, and reinstalling both 2019, and 2017, with reboots inbetween, but with no luck. I’m happy to try the entire process again, but I’m still a little confused about the aforementioned MSBuild files having a MG folder? If step B deals with templates being installed, and step C is pre-MG prerequisites, then is the MSBuild/Monogame folder and its contents created during E, the MGCB editor step? I’m only asking because that seems to be where the issue is stemming from and I can’t seem to figure out which step was missed which addresses that installation to begin with.

Thanks again

Beginning to suspect your account is an offline account and one that has a space in your username and user folder address…

EDIT

NO, nevermind saw your user folder above…

You don’t need to install everything, I only install Desktop and UWP…

When was the last time you did a fresh system install?

EDIT

Also, what antivirus [if other than the built-in one in Windows 10] are you using?

EDIT

If you use Discord:

You could get live chat support from other community members…

It is a mess, but you should get help fast, I sit in Off-Topic 24/7

I should add, I was reluctant to join it as I dislike the idea of it, but people reply fast…

2 Likes

I managed to solve this last night, but I’m not entirely sure why this step was unnecessary for everyone else but wasn’t able to work for me. It may have to do with older installs of VS on my PC, and it HAS been a very long time since I did a fresh install, and I’m assuming that may have been the cause of everything. Not sure.

So the issue for me was, as mentioned in that second error, the program was looking for a MonoGame folder inside an MSBuild folder, and it was searching in both VS’s MSBuild folder and the MSBuild install directory on C. So I went and had a look for these and noticed both folders did not have a MG folder. However, I did try to install the MSBuild content (and most of the others out of frustration) by using this specific package:

But for some reason when this package was installed, it just wasn’t installing correctly or maybe isn’t designed to install directly from the package download - since I’m new to those sort of dotnet packages. I figured it had to have gone somewhere though, so I did a system wide search of MSBuild using a program called everything (because my Win 10 search is disabled by default) and found an “MSBuild\MonoGame” folder structure in a temp folder within “AppData\Local”. I literally copy and pasted the contents from where I found it, to the MSBuild directory in my Program Files, and rebooted VS, and it worked. These are the files you need in MSBuild for others who may run into this issue when installing MG.

Annotation 2021-01-11 085738

Annotation 2021-01-11 085738_2

I’ve installed things using dotnet before, but the issue does seem like - if the original MSBuild files are kept in the dotnet package installed in Step D, they did not install correctly on my PC for whatever reason, despite getting no errors. I’m not sure if me downloading the additional packages from here helped or just confused the matter, I don’t really understand what failed, but regardless after manually moving the MonoGame Content Builder Task files to the expected folder, MonoGame began working for me (to clarify, specifically 2017, I still get template issues with 2019, but I’ve just uninstalled it).

Thanks for everyone’s suggestions and hopefully if anybody has a similar issue my day long frustrations may prove useful. I have joined he Discord now and plan to spend the day coding along to tutorials :smile:

1 Like

Starting to understand the issue…

What else have you disabled?

1 Like