I'm getting a strange exception when trying to load in a .tmx file using MonoGame.Extended. I can load the same .tmx file into other 3rd party libraries (tried to recreate the error) without any problem which makes me suspect it's not something to do with the file.

tiledMap = Content.Load<TiledMap>("Test");  //line of code for exception

Message:

Microsoft.Xna.Framework.Content.ContentLoadException Could not load Test as a non-content file!

up vote 2 down vote accepted

This error is most likely happening because the content hasn't been built correctly with the MonoGame Pipeline tool. All content in MonoGame must be built into an XNB file before in can be loaded into the game.

The first thing to check is to make sure you've added a reference to the MonoGame.Extended.Content.Pipeline.dll in your Content.mgcb file.

Open the Content.mgcb file in a text editor and look for lines like this:

#-------------------------------- References --------------------------------#

/reference:..\..\packages\MonoGame.Extended.0.3.44-alpha\lib\MonoGame.Extended.Content.Pipeline.dll

If it's not there you'll need to add it. Unfortunately, this reference is not automatically added when the NuGet package is installed so you'll need to do it manually.

Copy the above /reference line and add it to your Content.mgcb file. Make sure the path is correct, in particular the version number. You should be able to locate the DLL in your packages folder. There's also an install guide blog post that goes through this in more detail.

If everything is correct you should see the Tiled Map Importer and Processor show up in the Pipeline GUI.

enter image description here

  • Thanks so much for the response. I've done all of the above, but now the MonoGame pipeline is telling me I'm missing the 'Ionic.Zip' assembly when it attempts to convert the .tmx file. – MrVariable Dec 11 '15 at 13:17
  • Can you see the 'Ionic.Zip' file in the same directory as the MonoGame.Extended Content Pipeline dll? – craftworkgames Dec 11 '15 at 14:16
  • Ah, thanks for pointing me in the right direction. I noticed it was missing, so I reinstalled MonoGame.Extended. Everything's working perfectly now. – MrVariable Dec 11 '15 at 16:05
  • As an aside, I just noticed that you're the guy behind the library itself. I was thinking over the Christmas holiday of trying to create some Unity style docs to make things easier for other programmers new to MonoGame.Extended. I would really like to see this library get more of a foot hold than it already has. – MrVariable Dec 11 '15 at 16:08
  • Thanks. I'm glad you got it working. Yes I am the guy behind the library. Trying to do my bit to help fellow game developers. Any help with the project is always appreciated. We don't really have a proper forum yet, so raise an issue on github and we'll discuss it there. – craftworkgames Dec 11 '15 at 20:50

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.