[SOLVED] I've upgraded from 3.5 to 3.6 and now my .png files won't load.

I upgraded my project from 3.5 to 3.6 and now I receive this error in regards to loading in a .png file.

ContentLoadException was unhandled
An unhandled exception of type ‘Microsoft.Xna.Framework.Content.ContentLoadException’ occurred in MonoGame.Framework.dll

Additional information: The content file was not found.

These are the lines of code creating the issue:
players[0].texture = Content.Load<Texture2D>("testSpriteSheet.png"); level01SpriteSheet = Content.Load<Texture2D>("backgroundTest.png");

I am using Visual Studio 2015 on Windows 10. I’ve set both of the .png files to Copy always in the Copy to Output Directory. I’ve also created new 3.6 MonoGame projects that just load in a .png file and those generate the same error. Other than that, I’m not sure what would be causing this issue. Any help would be greatly appreciated.

Thank you for your time,

The reason why you can’t load raw image assets using Content.Load is because the support for it has been dropped. It was never intended to stay and the only reason why it was there is so that you could use MonoGame more easily without relying on XNA content pipeline (MonoGame didn’t have content pipeline at the time). This however does not mean you cannot load raw image files, to load them you now have to do the same thing you had to do in XNA:

var tex = Texture2D.FromStream(graphicsDevice, stream);

The downside of loading the image this way is that you’ll have to make sure to dispose of the resource when you are done using it.

remove the .png extension as its a content file and no longer has its original file extension or format

ContentManager previously supported (unlike XNA) loading png’s - and some other filetypes - directly like this. Seems like @CptTree is not using the MonoGame content tools so he’s actually trying to load png files and not xnb files.

1 Like

Thank you everyone for your help!

After doing some more research with your inputs, I stumbled across the Adding Art, Sounds, and More section in the MonoGame Documentation. This was something I skipped over when I first adopted MonoGame. The XNA book I was learning from, at the time, used Content.Load, so I just settled with that. I’ve went through the tutorial and converted my png files into xnb files with the Pipeline Tool. Everything is back in working order!