VS 2022 unable to open MonoGame.Framework.WindowsUniversal.csproj

Having recently installed VS2022 with components as needed to run MonoGame I came to loading up the MonoGame source code only to find that loading:

MonoGame.Framework.WindowsUniversal.csproj

Gives the following error (both with Develop and Master branch):

error : The SDK 'MSBuild.Sdk.Extras' specified could not be found.

Loading in VS 2019 continues to correctly, this is something affecting only VS 2022.

I’ve tried in vein to find some package or component that VS 2019 had that VS 2022 does not but I’m just not finding anything and the error continues.

One workaround is that I can edit and build the source (for UWP) using VS 2019 and successfully use the output DLL in a VS 2022 MonoGame UWP project but it would be so much better to be able to use VS 2022.

Does anyone have any ideas about this?

I think I have some good news on this problem.

I’m no expert in this at all, obviously, but after installing god knows what packages for VS2022, filling up my hard drive and finally just running out of options I discovered there is a “global.json” file in the root of the project that contains this, and ONLY this:

{
  "msbuild-sdks": {
    "MSBuild.Sdk.Extras": "2.0.54"
  }
}

Interesting so at least I now know the version of this thing it’s looking for. Googling for that, I found this:

Where they have a chart of all available SDKs:

So it seems that MSBuild.Sdk.Extras is not an option. But lower down in the page there is this:

Nuget? What’s Nuget got to do with it? Put that aside though, isn’t that exactly what I was looking for? So…the SDK comes from Nuget? But nothing at all about it on the “Manage Nuget Packages” screen? I’m confused but hey, they say either “include the version at the end of the name, or specify the name and version in the global.json file”. Hmmmm, the latter was already done and it didn’t bloody work in VS2022. So what if we try the former?

So I changed the project tag in the MonoGame.Framework.WindowsUniversal.csproj file from this:

<Project Sdk="MSBuild.Sdk.Extras">

to this:

<Project Sdk="MSBuild.Sdk.Extras/2.0.54">

And now…it loads in VS 2022.

I’m so pleased it works but, all that wasted time, for that! And I’m still confused at what this has to do with Nuget (aren’t Nuget packages downloaded into a User folder?):

SDK

If anyone can educate me on this I’d love to know what is going on here.