Failed to build map.tmx file with MonoGame.Extended

:wave: :wave:I wan’t to create a MonoGame Project but when I added MonoGame.Extended.Tiled to display and load my Tiled map, the content pipeline tool failed to build it


Can someone help me?
note: I’ve already add the reference, my MonoGame version is 3.8.1.303

Do not use the nuget package of extended.

  1. It will not work with MonoGame 3.8.1.

  2. The instructions on their page is wrong.
    You shouldn’t need to install the Content.Pipeline libraries in your main project. This will add ~50MB of tools and libraries to your published game that you don’t need. If you did add those references, remove them.

The correct way to do this, is to clone the git repo, build the libraries on your own, and finally copy them in your project under a new folder, lets say ‘/Libraries/Extended/’.
Then add a reference to the importers in your content.mgcb and references to the runtime libraries to your .csproj.

3 Likes

Thank you for the reply, I will try it now
Edit: I’ve already tried it and its actually work!
Thank you so much for the solution!

@Taqro11 Hello, recently I also came to the same error as you described. I tried to clone the MonoGame.Extended git repo and built it locally, I added references in content.mgcb:

/reference:../Extended/MonoGame.Extended.Content.Pipeline.dll
/reference:../Extended/MonoGame.Extended.dll
/reference:../Extended/MonoGame.Extended.Tiled.dll

and it worked, but when I’m trying to load map I’m getting an error:

Unhandled exception. System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.ReadString()
   at MonoGame.Extended.Tiled.TiledMapReader.ReadProperties(ContentReader reader, TiledMapProperties properties)
   at MonoGame.Extended.Tiled.TiledMapReader.ReadLayer(ContentReader reader, TiledMap map)
   at MonoGame.Extended.Tiled.TiledMapReader.ReadGroup(ContentReader reader, TiledMap map)
   at MonoGame.Extended.Tiled.TiledMapReader.ReadLayers(ContentReader reader, TiledMap map)
   at MonoGame.Extended.Tiled.TiledMapReader.Read(ContentReader reader, TiledMap existingInstance)
   at Microsoft.Xna.Framework.Content.ContentTypeReader`1.Read(ContentReader input, Object existingInstance)
   at Microsoft.Xna.Framework.Content.ContentReader.InnerReadObject[T](T existingInstance)
   at Microsoft.Xna.Framework.Content.ContentReader.ReadObject[T]()
   at Microsoft.Xna.Framework.Content.ContentReader.ReadAsset[T]()
   at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
   at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
   at test_project.Game1.LoadContent() in /Users/l3llff/Projects/game/test_project/Game1.cs:line 30
   at test_project.Game1.Initialize() in /Users/l3llff/Projects/game/test_project/Game1.cs:line 25
   at Microsoft.Xna.Framework.Game.DoInitialize()
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
   at Program.<Main>$(String[] args) in /Users/l3llff/Projects/game/test_project/Program.cs:line 3

I wonder if you faced this problem? Also can you tell how you added references to the runtime libraries to your .csproj? Thanks!