
Updating MonoGame from 3.5 (NuGet) to 3.6 (source)
For various reasons I had to update from MonoGame 3.5 (installed using NuGet) to 3.6 (using source code). Here is the process and issues I encountered:
- Most important – I used Rider 1.0 EAP (Build #RS-163.10479) for this, on Windows 8.1.
- Start with checking out the source code from GitHub.
- If, like me, you default to using SSH and get errors saying you don’t have the permission to clone the repo just switch to HTTPS.
- Follow the rest of the instructions from the page. Below are the steps I did specifically:
- Run
git submodule update --init
to initalize submodules. - Run
Protobuild.exe
, it took roughly half a minute to finish and generated lots of output.
- Run
- Open up your project in Rider or your IDE of choice – the steps might be slightly different for you if you’re not using Rider.
- Open up NuGet panel and remove MonoGame from it.
- Right click on your solution, select “Add existing project” and navigate to
MonoGame/MonoGame.Framework/
and select one of the projects to include. - Right click on each project, select “Add reference” and chose MonoGame from the list.
That’s it for the project setup. Now we need to iron out any leftover compilation errors and other issues:
- I had some references to
OpenTK
namespace but they weren’t used so it was as simple as removing them. - I have used
OpenTK
‘sVector2
class in one place, just had to hit Alt+Enter for it to auto import the correct one. -
Content loader failed on
IngameSheetTexture = content.Load("sheets/ingame.png");
– whoops. Turns out this code now only allows .xnb files? Let’s investigate… Found the culprit. You need to directly use theFromStream
methods. Clunkier but I can see why they made it so, the new, working code looks like this:using (var assetStream = TitleContainer.OpenStream("Content/sheets/ingame.png")) { IngameSheetTexture = Texture2D.FromStream(graphicsDevice, assetStream); }
And now it works!
[mc4wp_form id="444"]