Skip to content

Content Pipeline issues(...?) #1035

@CustomCharacter

Description

@CustomCharacter

Hello,

You said on the Discord to open this as an issue (even though I don't think it's an MGE issue), so here I am!

I am having issues with filepath references when it comes to nested folders and XNBs referencing them. Either the pipeline doesn't read the relevant filepath beyond Content at all, or it duplicates the given filepath. In either case, it (perhaps obviously) doesn't read the relevant file. Moving the requested file to the displayed filepath fixes the issue, but this isn't very tenable.

For my current working example, I have two files: missing-texture.json and missing-texture-sheet.png. These are intended to be used as my fallback texture in my game, and are trying to use MGE's Texture2DAtlas with the format and details of the JSON provided by TexturePacker. (The reason I don't think this is an MGE problem is that I had this issue earlier as well, with the MonoGame tutorial's Texture2DAtlas and my own XML files).

My relevant Content file structure is Content/Spritesheets/Map Textures/missing-texture*. This is replicated in the binary files of my compiled code, with two XNB files in bin/Debug/net8.0/Content/Spritesheets/Map Textures.

I have tried several different ways to rectify this to no avail. (Note that ...s below are censoring my personal info).

In my LoadContent function, when I call the Content Manager to load it:
TextureSheet = _contentManager.Load("Spritesheets/Map Textures/missing-texture") : returns the duplicated filepath: "System.IO.FileNotFoundException: Content/Spritesheets/Map Textures/Spritesheets/Map Textures/missing-texture-sheet.xnb"
TextureSheet = _contentManager.Load("missing-texture"): returns just the Content filepath: " ---> System.IO.FileNotFoundException: Could not find file '/.../Client/bin/Debug/net8.0/Content/missing-texture.xnb'."

In my JSON:
"filename": "Spritesheets/Map Textures/missing-texture-sheet.png" : Both Copy and Build actions work.
"filename": "missing-texture-sheet.png" : Only works with Copy, the MGCB refuses to build it otherwise.

With full filepath in code + short filepath and Copy in JSON, I get a different error:
Could not copy the file "/.../Client/Content/bin/DesktopGL/Content/Spritesheets/Map Textures/missing-texture.xnb" because it was not found. [/.../Client/Client.csproj]
(this file does NOT exist at this filepath. I don't know why it's looking in DesktopGL when everything else in my project seems to look in .NET 8.0, but maybe this is the cause? I don't have the knowledge base to discern what the deal of this might be, and if it's a concern or not.

In the MGCB:
Changing either Build option away from Spritesheets/Map Textures/missing-texture* causes the build to crash: "The command ""/.../.nuget/packages/monogame.content.builder.task/3.8.4/build/dotnet-tools/mgcb" /quiet /@:"/.../Client/Content/Content.mgcb" /platform:DesktopGL /outputDir:"/.../Client/Content/bin/DesktopGL/Content" /intermediateDir:"/.../Client/Content/obj/DesktopGL/net8.0/Content" /workingDir:"/.../Client/Content/"" exited with code 1. [/.../Client/Client.csproj]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions