# Issue importing TileMaps/TileSets in Monogame.Extended 1.0

I've just started coding my first ever videogame using Monogame/Xna. I've reached a point where I would like to start editing maps and importing them into my game using the program Tiled. After reading through the tutorials for Monogame.Extended, I was able to install version 1.0 using NuGet commands, and configure the content pipeline tool references accordingly. Right now, my packages file looks like this:

<packages>
<package id="MonoGame.Extended" version="1.1.0" targetFramework="net45" />
<package id="MonoGame.Extended.Content.Pipeline" version="1.1.0" targetFramework="net45" />
<package id="MonoGame.Extended.Graphics" version="1.1.0" targetFramework="net45" />
<package id="MonoGame.Extended.Tiled" version="1.1.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
</packages>


And Content.mgcb looks like this:

#-------------------------------- References --------------------------------#
/reference:..\..\packages\MonoGame.Extended.Content.Pipeline.1.1.0\tools\MonoGame.Extended.Content.Pipeline.dll


I have a basic map [Orthographic] that is 64 x 64 tiles of size 32 x 32. The content manager allows me to import both the Map.tmx and Tileset.tsx into the project. However, it will fail to compile with one of two errors:

1) If there is a Tileset.tsx file in the Content Manager:

Couldn't find a default importer for 'C:/Users/*****/source/repos/HeavyMetalMachines/HeavyMetalMachines/Content/maps/Test.tsx'!


2) If there is only Map.tmx file in the Content Manager:

DirectoryNotFoundException: Could not find a part of the path 'C:\maps\TestMap.xnb'.


My Content is obviously not directly under my C:\ drive, so I am confused by the second error. It almost seems as if VStudio is converting the map to binary and then trying to place the converted map under C:? The command I am using to import the content is as follows:

//Tiled Test
private MonoGame.Extended.Tiled.TiledMap lcTestMap;
.
Content = new ContentManager(this.Services, "Content");
.
lcTestMap = Content.Load<MonoGame.Extended.Tiled.TiledMap>("/maps/TestMap");


I would like to know if I missed a critical step in the configuration, or if I am not using these classes correctly. I do plan on strictly using Isometric maps in this game, so I'm hoping that it will not be too different from this test. Oh, and I'm using Visual Studio Pro 2017 with Monogame 3.6 - in case that has some impact as well...

Thanks in advance for any help you might have!

• Just a quick stab in the dark here (I only have a minute right now). Try taking out the first slash.. so Content.Load("maps/TestMap") instead. If that doesn't work I'll come back and try to answer the question in more detail. Jun 11, 2018 at 6:01
• Thanks, I'll try out this change when I get home tonight and post the results. Jun 11, 2018 at 16:13
• So I tried out your suggestion. I am still getting the following error: Couldn't find a default importer for 'C:/Users/*****/source/repos/HeavyMetalMachines/HeavyMetalMachines/Content/maps/Test.tsx'! Jun 12, 2018 at 0:36

## 1 Answer

Okay, so let me explain in more detail what's going on here.

1) If there is a Tileset.tsx file in the Content Manager: Couldn't find a default importer

I think what's happening here is that we don't support external tileset files (.tmx) in MonoGame.Extended 1.1. We'll be adding support for this in 2.0.

This is because the Tiled importer was written when the Tiled Map Editor embedded the tileset into the map by default. Now, in newer versions embedding the tileset is an option you need to turn on manually as shown in the screenshot below:

var tiledMap = Content.Load<TiledMap>("/maps/TestMap");


DirectoryNotFoundException: Could not find a part of the path 'C:\maps\TestMap.xnb'.

When you put a leading slash in front of the path you're actually saying "make this path relative to the root of the current drive". To be honest, it seems a little odd that the MonoGame ContentManager would even let you load content this way, but in any case it does explain why it's trying to load the file from the path shown in the error.

Simply removing the leading slash tells the ContentManager that you want to load the content relative to the Content folder as you'd expect.

var tiledMap = Content.Load<TiledMap>("maps/TestMap");


Happy coding!

• Wonderful! This worked perfectly, thank you so much. The relative path makes sense, I guess I expected the ContentManager to know it's parent directory due to how it was instantiated. It also seems that you need a copy of the Tile.png image in the content manager as well as the map.tmx (probably because the map data has references to it from Tiled). I still need to figure out how to draw the map using a SpriteBatch, but I'm thinking that won't be too difficult to figure out. Thanks again! Jun 12, 2018 at 16:13
• Take a look at the demos in the master branch on GitHub. Also, click the tick to accept the answer Jun 12, 2018 at 21:21
• I my self am having a problem with the TileSet and i made sure i embeded it into the map but it is still looking for the Jul 9, 2019 at 17:34