I have the same problem but the solution mentioned here does not work for me. Has anyone had an alternative solution? To give more detail, I am new to this framework. I downloaded and installed the latest version of Monogame via Visual Studio. I followed the instructions in the Getting Started documentation on this website and I got the error. I (probably wrongly) attempted to install XNA on its own but after doing so it did not appear in the reference manager.
In my case the problem was apparently with my Windows username, which had a space in it. Someone in the Discord mentioned that this was a bug with the stable version. So instead I installed the development version at Install a development MonoGame build - Learn MonoGame which works for me.
For anyone having this problem and the pinned solution isn’t working:
For me the solution was that if you are using MonoGame 3.8.1 or newer, then your game project must target .NET 6 or newer.
However this fix lead to another problem which I managed to fix it by adding " before and after the text $(MGCBPath) inside MonoGame’s content builder file. This was help from a comment here under “Dylan_Hall” as I noticed my problem code seemed kind of close to their solution. With a shot in the dark it worked.
The MonoGame discord community helped a lot as well. You can find their discord link at the bottom of the monogame website (would’ve linked it but new users only get 2 links)
For further help, these specific problems have been recorded:
My personal problem was that MonoGame was on auto update so when 3.8.1 rolled around I had no idea what went wrong. Unfortunately, I was still using VS 2019 as it was the latest version that worked with MonoGame at the time I believe. Hope this helps.
I had this problem but couldn’t solve it the same way. Checked my nuget package menu and my packages said “Nuget package “Not available in this source””. Ultimately found this post and solved it this way.