Hi,
I have a project called Scavengers.Content with the following folder structure:
Scavengers.Content
/Content
/Maps
/Scavengers_Tileset_01_png.png
/Scavengers_Tileset_01_tsx.tsx
/SimpleRoom01.tmx
And I have another project called Scavengers.DesktopGL that looks like this:
Scavengers.DesktopGL
/Content
/content.npl
The content.npl file looks like this:
{
"root": "../../Scavengers.Content/Content/",
"references": [
"../../../../../.nuget/packages/monogame.extended.content.pipeline/3.8.0/tools/MonoGame.Extended.Content.Pipeline.dll",
"../../../../../.nuget/packages/monogame.extended.content.pipeline/3.8.0/tools/MonoGame.Extended.Tiled.dll",
],
"content":
{
"textures":
{
"path": "Textures/*.png",
"recursive": "True",
"action": "build",
"importer": "TextureImporter",
"processor": "TextureProcessor",
"processorParam":
{
"ColorKeyColor": "255,0,255,255",
"ColorKeyEnabled": "False",
"GenerateMipmaps": "False",
"PremultiplyAlpha": "True",
"ResizeToPowerOfTwo": "False",
"MakeSquare": "False",
"TextureFormat": "Color",
}
},
"maps":
{
"path": "Maps/*.tmx",
"recursive": "False",
"action": "build",
"importer": "TiledMapImporter",
"processor": "TiledMapProcessor"
}
}
}
Building the project works fine. Nopipeline processes all of the files and outputs a mgcb file that looks like this:
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
/reference:../../../../../.nuget/packages/monogame.extended.content.pipeline/3.8.0/tools/MonoGame.Extended.Content.Pipeline.dll
/reference:../../../../../.nuget/packages/monogame.extended.content.pipeline/3.8.0/tools/MonoGame.Extended.Tiled.dll
#---------------------------------- Content ---------------------------------#
#begin ../../Scavengers.Content/Content/Textures/house.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=False
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:../../Scavengers.Content/Content/Textures/house.png;Textures/house.png
#begin ../../Scavengers.Content/Content/Textures/player.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=False
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:../../Scavengers.Content/Content/Textures/player.png;Textures/player.png
#begin ../../Scavengers.Content/Content/Maps/SimpleRoom01.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:../../Scavengers.Content/Content/Maps/SimpleRoom01.tmx;Maps/SimpleRoom01.tmx
I’m completely new to MonoGame, but judging by all of the other mgcb files I’ve seen, this looks fine.
The problem arises when I do Content.Load(“Maps/SimpleRoom01”) from the DesktopGL project. I get a FileNotFoundException because the path
/Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.DesktopGL/bin/Debug/netcoreapp3.1/Content/Scavengers.Content/Content/Maps/Scavengers_Tileset_01_tsx_0.xnb
cannot be found. And that’s correct, it’s invalid. The correct path should be
/Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.DesktopGL/bin/Debug/netcoreapp3.1/Content/Maps/Scavengers_Tileset_01_tsx_0.xnb
without the extra Scavengers.Content/Content
/Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.DesktopGL/bin/Debug/netcoreapp3.1/Content/Scavengers.Content/Content/Maps/Scavengers_Tileset_01_tsx_0.xnb
The full stack trace from Content.Load is:
Unhandled exception. Microsoft.Xna.Framework.Content.ContentLoadException: The content file was not found.
---> System.IO.FileNotFoundException: Content/Scavengers.Content/Content/Maps/Scavengers_Tileset_01_tsx_0.xnb
---> System.IO.DirectoryNotFoundException: Could not find a part of the path '/Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.DesktopGL/bin/Debug/netcoreapp3.1/Content/Scavengers.Content/Content/Maps/Scavengers_Tileset_01_tsx_0.xnb'.
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.IO.File.OpenRead(String path)
at Microsoft.Xna.Framework.TitleContainer.PlatformOpenStream(String safeName)
at Microsoft.Xna.Framework.TitleContainer.OpenStream(String name)
at Microsoft.Xna.Framework.TitleContainer.OpenStream(String name)
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(String assetName)
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.Content.ContentManager.OpenStream(String assetName)
at Microsoft.Xna.Framework.Content.ContentManager.ReadAsset[T](String assetName, Action`1 recordDisposableObject)
at Microsoft.Xna.Framework.Content.ContentManager.Load[T](String assetName)
at Microsoft.Xna.Framework.Content.ContentReader.ReadExternalReference[T]()
at MonoGame.Extended.Tiled.TiledMapReader.ReadTilesets(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 Scavengers.Core.ScavengersGame.LoadContent() in /Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.Core/ScavengersGame.cs:line 39
at Microsoft.Xna.Framework.Game.Initialize()
at Scavengers.Core.ScavengersGame.Initialize() in /Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.Core/ScavengersGame.cs:line 31
at Microsoft.Xna.Framework.Game.DoInitialize()
at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
at Microsoft.Xna.Framework.Game.Run()
at Scavengers.DesktopGL.Program.Main(String[] args) in /Users/mandarin/Dev/Scavengers/Scavengers.MonoGame/Scavengers.DesktopGL/Program.cs:line 10
If I’m not complete off, the culprit might be these lines:
at MonoGame.Extended.Tiled.TiledMapReader.ReadTilesets(ContentReader reader, TiledMap map)
at MonoGame.Extended.Tiled.TiledMapReader.Read(ContentReader reader, TiledMap existingInstance)
Does anyone have any experience with using nopipeline together with the Extended.Tiled library?