Visual Studio 2019 has been released today but monogame doesn't support templates for vs 2019. I tried to install monogame from the site after installing vs 2019 but templates didn't appear.
Got the following error message in VS 2019:

As a workaround you can create the project with this
dotnet new --install MonoGame.Templates.CSharp
dotnet new mgdesktopgl -o MyGame
Hello,
I managed to create and launch a MonoGame Project in Visual Studio 2019 by copying all the MonoGame templates from %USERPROFILE%\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#\MonoGame to %USERPROFILE%\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#\MonoGame
Once the MonoGame Project created I just had to change the default Program used to open the Content.mgcb file, the default path for the MonoGame Pipeline Tool is : C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\Pipeline.exe
Hope it could help someone until MonoGame officially support Visual Studio 2019.
Regards
As a workaround you can create the project with this
dotnet new --install MonoGame.Templates.CSharp dotnet new mgdesktopgl -o MyGame
This works but note that the resulting project has a compilation error. You'll end up with a Game1.cs and Program.cs. Within the Program.cs you'll want to reference the namespace used by your Game1 (or just put them in the same namespace).
Right-click the project file, open in VS2019 and you're off!
I could not find templates for VS 2017 anywhere, so that I had to install VS 2017 to get them. Leaving them here until there is no support of Visual Studio 2019 in the official MonoGame installer.
Unzip to Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#.
I commit my changes in this pull request: https://github.com/MonoGame/MonoGame/pull/6771 , I Guess that after this this issue is fixed.
I could not find templates for VS 2017 anywhere, so that I had to install VS 2017 to get them. Leaving them here until there is no support of Visual Studio 2019 in the official MonoGame installer.
Unzip to
Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#.
Only have VS2019 installed, this helps a lot, thanks!
This Version of the templates in the zip file do not appear in VS2019 for me. I compared them with VS2019 templates and updated the following tags in each of the .vstemplate files. Platform tag of Android is an example for the Android MonoGame project type.
For VS 2019 unzip the VS2019MonoGame.zip file below to:
Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#\
instead of the MonoGame.zip above. This will make the different MonoGame project types appear in the project creation screen in VS2019. Make sure you have installed MonoGame for Visual Studio already first. Hope this helps someone.
This will give you a view like below. Select "Games-MonoGame" in the last dropbox filter to see them all.

@toddalbers Your project templates worked for me on VS 2019 for Mac. I don't know how to add them as project templates to VS 2019 for Mac, but opening MonoGameDesktopGLApplication as a project and replacing the placeholder values worked fine.
Thank you @toddalbers, that worked a treat. I was caught off-guard that they weren't coming up in a search for MonoGame, but using "Games-MonoGame" in the dropdown as directed fixed me up.
FYI, MonoGame is moving away from traditional Visual Studio templates and is now based on the dotnet CLI.
Which means that creating new projects will work with dotnet new instead of the VS wizard.
The VS templates are still around but are likely to be removed soon (altogether with the installer; it will entirely work with nugets).
A new documentation will be put together to explain the CLI.
I do plan to create a vsix that installs the templates. We should be able to build the vsix from the dotnet templating templates so there's no extra effort involved once it's set up.
@mrhelmut @Jjagg Will the Pipeline tool still be used/needed after moving away from the installer? If not: how will you add content to a MonoGame project?
The pipeline tool will still be around, but it will work through nuget and act as a dotnet global tool.
Can't figure out how to install Monogame anymore. No installer for Visual Studio 2017 is available, and I cant install templates without it. Would be nice With a guide how to create a project
FYI, MonoGame is moving away from traditional Visual Studio templates and is now based on the dotnet CLI.
Which means that creating new projects will work withdotnet newinstead of the VS wizard.The VS templates are still around but are likely to be removed soon (altogether with the installer; it will entirely work with nugets).
A new documentation will be put together to explain the CLI.
Why? The VS template wizard sounds more practical and easier.
I intend to create a vsix with the templates so you can use them from VS.
In my latest version of VS2019 (16.4.1) neither of the .zip files provided here show up in Visual Studio no matter where I try to put it (documents/etc. or /users/etc.). Would like to a working VSIX for this.
Also I sure hope this team doesn't abandon Visual Studio templates. There are templates for .NET core projects still and while you can create projects with the dotnet new command, it's not for everyone and there's no reason to not provide templates for VS2019.
It was released over 6 months ago and there's still no installer that supports them and while the dotnet CLI option is nice, I've heard this line for awhile now without any documentation or support for it.
MonoGame is moving to VS2019, don't worry, support will happen for both the CLI and the regular wizards.
For the time being, the current source only support VS2019 through the CLI, while the installer doesn't support it at all.
The installer will be dropped and replaced with a nuget-based distribution model, while the templates will be provided by both nugets for the CLI and (we hope so) a VS extension for wizards.
No ETA. If you wish to help speed up this transition process, you are very welcome to check #6879.
Maybe this can help for macOS users. Install Xamarin Studio (brew cask install xamarin-studio), and then Monogame (brew cask install monogame).
Open Xamarin Studio and templates will be there :) Create your project, close it and open it with Visual Studio :)
It's clearly not the solution, but it helps me create my project.
You can uninstall Xamarin if you want (brew cask uninstall xamarin-studio).
By the way!
If you already installed Monogame before installing Xamaring, simply uninstall it and install it again through brew, simpler. If you don't do this, you won't see the template.
A new documentation will be put together to explain the CLI.
@mrhelmut Any more information on the proper commands for people who aren't familiar with VS? I haven't found the instructions (that's how I ended up here) and got stuck on the "Getting Started > Creating a New Project"-part of the main documentation.
The new documentation is still being cooked up and the nugets aren't public yet.
For now, you'll have to build the nugets yourself with ./build.ps1, and reference them locally.
You can check the future documetation's progress here: #6988
I've compiled the newest version of dotnet templates 2 months ago, with minor tweaks to nuget / versions of nuget they used and uploaded it: https://www.nuget.org/packages/MonoGame.Templates.CSharp/
I'll try to compile vs mac extension later today, I've already had to fix it up and connect it to the new build system so it should work fine.
Here, just unpack the zip, and than install the .mpack file by going into vs for mac extension manager, and selecting install from file:
MonoDevelop.MonoGame_IDE_VisualStudioForMac_3.8.0.1.mpack.zip
@harry-cpp Thanks, I can select a MonoGame template on startup now 🎉
I tried running it against .NET Core 3.1, but received an error:
Unhandled exception. System.TypeInitializationException: The type initializer for 'Sdl' threw an exception.
---> System.Exception: Failed to load SDL library.
at Sdl.GetNativeLibrary()
at Sdl..cctor()
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.SdlGamePlatform..ctor(Game game)
at Microsoft.Xna.Framework.Game..ctor()
at MyGame.Game1..ctor() in /Users/xx/Game1.cs:line 12
at MyGame.Program.Main() in /Users/xx/Program.cs:line 10
I assume I have to install and use the 3.0 target for now?
EDIT: Ok looks like 3.0 throws the same error. Do I have to install SDL manually as well?
Check #6999.
@mrhelmut Thanks, after copying the SDL and openAL files to the root output folder it seems to work fine.
Cheers 🍺
I'll push a fix for DesktopGL.Core nuget package tomorrow so no extra steps will be needed.
New package is live.
I'm gonna close this as vs for mac extension can be made from the development branch, and if anyone needs it you can grab a build from me above.
New package is live.
I'm gonna close this as vs for mac extension can be made from the development branch, and if anyone needs it you can grab a build from me above.
What about templates for Windows? That issue is still not closed, right?
Oh, this is for both windows and mac, my bad, always treated them as 2 different things.
Here, just unpack the zip, and than install the .mpack file by going into vs for mac extension manager, and selecting install from file:
MonoDevelop.MonoGame_IDE_VisualStudioForMac_3.8.0.1.mpack.zip
This does not include an iOS template, right?
Accidentally, yes, it does not include it, tho if you compile it from source they will be included now.
The compiled ones would be the same templates you get from the dotnet CLI, I'm guessing?
I'm a novice and still don't know how to create monogame templates in vs2019, in win.
Can you come up with a detailed tutorial
我是新手,仍然不知道如何在vs2019中创建独占游戏模板。 你能拿出一个详细的教程吗
I finally chose to download vs2017
@2858199552 You can read this page: https://github.com/harry-cpp/MonoGame/blob/newprojdocs/Documentation/setting_up_project/setting_up_project.md
It says visual studio code, but it works for vs2019.
@2858199552 You can read this page: https://github.com/harry-cpp/MonoGame/blob/newprojdocs/Documentation/setting_up_project/setting_up_project.md
It says visual studio code, but it works for vs2019.
Ok, thank you very much, I have started to learn and use it
The new documentation is still being cooked up and the nugets aren't public yet.
For now, you'll have to build the nugets yourself with./build.ps1, and reference them locally.
You can check the future documetation's progress here: #6988
@mrhelmut, I wanted to try out the new nuget files locally but after I cloned the repo I wasn't able to find the 'build.ps1' file. I can only see the 'build.cake' and the 'cake.config' files. Am I missing something here? Sorry for the basic question...
This has evolved since I last commented about it.
To build monogame from source, you now have to install Cake as a global tool:
dotnet tool install --global Cake.Tool
Then all you'll have to do is dotnet cake and nugets will be output to the Artifacts folder.
Note that this requires the .NET Core 3 SDK.
This has evolved since I last commented about it.
To build monogame from source, you now have to install Cake as a global tool:
dotnet tool install --global Cake.Tool
Then all you'll have to do isdotnet cakeand nugets will be output to the Artifacts folder.Note that this requires the .NET Core 3 SDK.
Ah! Thank you very much for the quick reply.
I've followed your instructions and I now have the nugets locally.
I've also installed the 'MonoGame project templates' extension for VS2019 and I've successfuly created a running Android project using the templates (just had to fix the nugets that are being referenced).
Very cool stuff!
Thanks!
Cheers!
The new monogame version should release soon with all the updated documentation.
Hi @mrhelmut
I really love what you did with the NuGet packages and the cake command. By all means I am not trying to be impatient or rude. I know you guys have your hands full so I understand that not everything is updated and I really appreciate what you are doing. But would it be possible for you guys to update the README with more instructions for manual building? I cloned the develop branch and could not find an instruction about the "cake" command in it. Heck, I even started building those packages manually as I thought that was the way to go. It was mere luck that I found this issue. And honestly, running "dotnet cake" is way easier than all stuff I did haha
Same for the template. I was fiddling around with those as well for VS2019 and I could not figure out where the bloody vstemplate config files were. I just read here that I could use the dotnet cli to use the NuGet package to generate a project. Imho I prefer that approach even more. Other than that really well done! ^_^
Hey
Credits on the refactor and new distribution model mostly go to @harry-cpp @Jjagg and @jnoyola.
It is very true that MonoGame currently is in a strange state with code being ahead of the documentation and the website in preparation of the 3.8 release. Unfortunately it is likely to stay in this state for a few more days/weeks until the website update and nugets are published.
Everything is mostly done, including the documentation, and waiting for a few tasks to complete.
Maybe a readme update could at least warn of the ongoing transition state.
The team is working toward releasing 3.8, which is expected to come with a website and documentation update (which will fully cover installation templates, using the framework, and publishing games).
Hi @mrhelmut
Thanks a lot for the heads up! And thanks for the information, in that case I will gladly await the upcoming release and its updated website and documentations. I fiddled around more in the meantime and I am quite surprised how much it changed, in the good way that is. But I also found a bug in the MonoGame.Content.Builder.Editor.Windows project, which I managed to solve locally.
I have the feeling you know more on the subject at hand than I do. By any chance, would it be interesting for the developers if I opened up a pull request or issue with my fix attempt for the bug in the WPF project, or is the gui editor going to be removed?
I have the feeling you know more on the subject at hand than I do. By any chance, would it be interesting for the developers if I opened up a pull request or issue with my fix attempt for the bug in the WPF project, or is the gui editor going to be removed?
The GUI editor is here to stay, so absolutely, a PR would be very welcome.
Hi,
Will there be any breaking change with the 3.8? I have only VS2019 installed and could try to make it the 3.7.1 work, but since it's the first time I'm using MonoGame, I'd like to do it properly.
If there is no breaking change, I suppose the release of the 3.8 could be done before releasing the website since the existing one (https://www.monogame.net/documentation/) seem pretty clear.
why hasn't this been implemented?
people on the monogame discord say the 2019 templates are literally the 2017 ones
if this is the case whats so hard about adding a install templates for visual studio 2019 in the monogame installer?
people on the monogame discord say the 2019 templates are literally the 2017 ones
They aren't. They are entirely new templates and MonoGame 3.8 is only compatible with VS2019 (previous versions of VS won't be able to work with 3.8).
Again, 3.8 is not yet available, anywhere. If you stumble upon nugets that are labelled as 3.8 and that are not published by the MonoGame organization (https://www.nuget.org/profiles/MonoGame), then it's not the proper ones (and may be outdated and/or not on par with the documentation).
The documentation has already been updated for 3.8 (which means that the release is close), but 3.8 itself, as well as its templates, is not yet published.
At the present time, the one and only way to try out 3.8, is to build MonoGame from source code and referencing it manually (either via direct csproj references, or via packing the nugets and hosting them locally).
If you're not sure about the process, please stick to the current 3.7 installer.
3.8 will not introduce breaking changes from an API perspective, but it does require new project templates and a switch to VS2019.
We now publish a VS extension to the VS Marketplace with the templates.
Most helpful comment
I could not find templates for VS 2017 anywhere, so that I had to install VS 2017 to get them. Leaving them here until there is no support of Visual Studio 2019 in the official MonoGame installer.
MonoGame.zip
Unzip to
Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#.