Problem loading assets from DesktopGL

I’ve been using the latest dev build for a few days, noticed that when trying to load a spritefont xnb asset that the content manager throws an exception saying the asset cannot be loaded as a content file.

Further inspection revealed the inner exception being that Monogame doesn’t consider the spritefont to be a valid xnb file despite it being compiled by the content pipeline tool. I looked at the source code and noticed the content manager checks the first 4 bytes of an xnb in order to determine if it is valid or not. Using a HexEditor I manually edited the 4th byte from the “d” which is used for DesktopGL projects and changed it to “w” for Windows. The spritefont loads and draws correctly. I also tested this with some of the other project types and a few of them cause an error in the same way that the DesktopGL “d” did.

What should I do in order to get around this issue? I tried just changing the platform in the pipeline tool to Windows but it seems Visual Studio will force it back to DesktopGL.

I would recommend that you create a new project and move all your files to it, this is because the new templates also come with native libs needed for each platform.

The reason why VS sets the platform is because it’s defined in .csproj file, you could edit it by hand to say DesktopGL, ie:

    <MonoGamePlatform>DesktopGL</MonoGamePlatform>

Thanks, I ended up looking at the csproj and found that line and set it to Windows for now.