MonoGame.Extended icon indicating copy to clipboard operation
MonoGame.Extended copied to clipboard

[Tiled] MGCB not handling reference properly

Open kaltinril opened this issue 2 years ago • 15 comments

I'm not sure if I'm missing a step, or if I'm doing something wrong, but after I add my MonoGame.Extended.Content.Pipeline.dll in the editor (before I save/close the editor) I can add a tmx file and change it's content processor to tiled, but once I save and close it, the tmx reference dissappears from the content.mgcb file, and when I open it again, the editor displays an odd folder path, as if it's trying to load the reference like a content asset?

[blank folder] -> [build=]

  • -> [build=]
    • -> MonoGame.Extended.Content.Pipeline.dll

Fresh brand new project (MonoGame.Framework.DesktopGl) VS 2019 .net core 3.1.420 installed along with 5.0.408 MonoGame.Extended 3.8.0 MonoGame 3.8.0.164

Complete Content.mgcb file:

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform)
/platform:DesktopGL
/config:
/profile:Reach
/compress:False

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

/reference:..\..\..\..\Users\myusername\.nuget\packages\monogame.extended.content.pipeline\3.8.0\tools\MonoGame.Extended.Content.Pipeline.dll

#---------------------------------- Content ---------------------------------#

#begin Levels/level1.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Levels/level1.tmx

Before: image

After: image

Error if trying to "build" with no content": image

However, if I add a tmx file, it shows me all the Extended content importers, but fails to build still: image

Project structure: image

kaltinril avatar Jun 26 '22 04:06 kaltinril

UPDATE: I copied MonoGame.Extended.Content.Pipeline.dll to the root of the project in the solution, and referenced it there instead.

Now the reference stays put, however, when I add a TMX file, there is no option for Tiled in the Importer.

image image

kaltinril avatar Jun 26 '22 06:06 kaltinril

I think that a relative path to the MonoGame.Extended.Content.Pipeline.dll cannot be determined when your repository is not located under C:\Users\myusername.

In my case, I'm using the exact same location for the repository (C:\Git) and I'm suffering from the same problem you're having.

Since MonoGame.Extended.Content.Pipeline.dll is a NuGet tool, it isn't copied to the bin directory when the .NET project is built. This means that we'll need to reference it in the .nuget directory, which is located under C:\Users\myusername by default. But, since our repository isn't located under C:\Users\myusername, we'll need to include C:\Users\myusername in the path because we can't reach like we otherwise could've done using a relative path that stays inside the user directory.

Having your username hardcoded in a path is of course unacceptable (especially if you're sharing code across machines or with other people) but I have no idea how to work around this without moving my repository somewhere under C:\Users\myusername (e.g. Documents\Git).

If you were to move your repository, you shouldn't need to copy the dll to your project root anymore and use the following reference instead:

/reference:..\..\..\..\.nuget\packages\monogame.extended.content.pipeline\3.8.0\tools\MonoGame.Extended.Content.Pipeline.dll

I took the reference from this demo. You might need to adjust the number of ..\s to match your situation.

sandord avatar Jul 26 '22 22:07 sandord

Was this resolved ever or is it still in a work-around status?

kaltinril avatar Apr 03 '23 02:04 kaltinril