Visual Studio 2019, Namespace XNA not found

Hi!

I’m using Visual Studio 2019, Windows 10 and Monogame 3.7.1.189. I would like to get familiar with creating mobile game iOS- & Android-Apps with Xamarin, so I downloaded this Monogame-example: https://developer.xamarin.com/samples/mobile/ModelRenderingMG/
This example works fine with my installation (it runs in the android emulator without problems). Then I tried to create a new own project: Visual Studio 2019 -> Create new Project -> Mobile App (Xamarin.Forms)
Then I added the following packages via NuGet:

  • Monogame.Framework.Android (v3.7.1.189)
  • Monogame.Framework.iOS (v3.7.1.189)

In App.xaml.cs I added the following code:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.Input;

Now the following error occurs: CS0234 - Type or Namespace “XNA” wasn’t found in Namespace “Microsoft”

Anyone has an idea what is wrong?

Thank you very much in advance!!

Best regards,
Bell430

Maybe it is worth trying: Create new Project-> MonoGame Android Project or MonoGame iOS Project?

Unfortunately this option is not available. It is only available as NuGet-Package.

Try adding “MonoGame Extension” or “MonoGame Addin” to the Visual Studio add-in, then select “MonoGame … Shared …” in the project to create the project. You can refer to the Microsoft documentation “https://docs.microsoft.com/en-us/xamarin/graphics-games/monogame/introduction/part1”.

I can’t find these extension in the VS-Installer. I also downloaded the latest version of Monogame from the Monogame-Website, but this also didn’t help. The installer from Monogame also doesn’t list VS 2019. It just offers templates for older versions of VS. Could it be that Monogame is not (yet) compatible with VS 2019?

I don’t think Visual Studio 2019 is supported by the latest version of MonoGame.

You could try installing Visual Studio 2017 temporarily until MonoGame is updated.

If you don’t see the Monogame template on startup, you can try copy the Monogame folder from

<username>\Documents\Visual Studio 2017\Templates\ProjectTemplates\Visual C#

to
..\Visual Studio 2019\...\Visual C#

Hope it helps.

Thank you. The templates show up now and XNA is also found. But now other references don’t work. I downgraded now to VS 2017 and now everything works much better. Obviously it’s too early for VS 2019.