如何在 Visual Studio 2019 社区版中打开一个新的 MonoGame 桌面项目?

How to open a new MonoGame Desktop Project in Visual Studio 2019 Community Edition?

我听说 MonoGame 是 XNA 的替代品,但我不知道如何打开桌面项目。

具体来说,我应该安装什么工作负载才能在 Windows 上开发 MonoGame 项目?

MonoGame 未与 Visual Studio 一起安装(顺便说一句,XNA 也没有)。您需要单独安装它。这个过程在他们的文档中有很好的描述:http://www.monogame.net/documentation/?page=Setting_Up_MonoGame

MonoGame v3.7.1 不正式支持 Visual Studio 2019,但这只是因为它没有在正确的位置安装 Visual Studio 项目模板。

this issue 有很多变通方法,包括 uranusexplorer 的这个变通方法:

I could not find templates for VS 2017 anywhere, so I had to install VS 2017 to get them. Leaving them here until there is support for Visual Studio 2019 in the official MonoGame installer.

Download MonoGame Visual Studio Templates

Unzip to Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#

有趣的是,正是出于这个原因,我最近在 github 上创建了一个 MonoGame Hello World 项目。如果您只想开始,可以下载该项目并在 Visual Studio 2019 年打开它。

或者,您可以创建一个 MonoGame .NET Core project,它也可以在 Visual Studio 2019 年使用。