MonoGame Content Pipeline Extension Errors

Hey guys,

I was following a tutorial to create a custom content pipeline extension ( MonoGame Content Pipeline Extension). After I add the new reference to the Content Manager, I cannot rebuild the content anymore due to the error in the screenshot.

That is the first thing I need to solve and I need help for :slight_smile: .

After I fiddled around a bit and solved it somehow, the JSON file I added is still not able to be imported.

You can find the code here: https://github.com/BanditBloodwyn/Grim-Veil.

What is the problem? Maybe my project structure or project names?

Hey @BanditBloodwyn
The error message is specifically about the TextureProcessor which is one of the built in types of the MGCB, not sure why it would throw an error when making a custom extension. Sometimes you’ll see error for the writers because they have a similar TInput signature as one of the built in writers, but not processors.

I tried looking at the code, but your link is invalid.

You may also want to post this over on the new GItHub discussion forums as the community forums here are moving there soon

Sorry, my mistake. I made the repository public, so you can check the code now :slight_smile:

I see that System.Runtime is version 8.0.
Did you build the extension for net8 ?
The executable content builder is net6. Try rebuilding the extension targeting net6.

That might or might not be it… :grinning:
I’ am not familiar with the error, it’s just a guess.

1 Like

That was a guess of mine too. But unfortunately, it’s not the solution.

No one have an idea?

I believe the problem is here

look into \ContentPipelineExtension.Json\bin\
Do you see a monogame.framework.dll ? That is the DesktopGL build.
The pipeline is uses the WindowsDX build. There is a conflict of types when mgcb tries to load extensions DLLs.

You need to add <PrivateAssets>All</PrivateAssets>

as it is here.

Well no, this file is not there.

When I add this new line in the project file, I get this error message when I rebuild the content in the Content Manager:

Still the same as before.

What’s in the \ContentPipelineExtension.Json\bin\ folder? can you copy a list?

Remove everything other than the DLL of the extension itself, and then rebuild.

Here the content of the folder “Grim-Veil\ContentPipelineExtension.Json\bin”:

  • Debug
    • net8.0
      • ContentPipelineExtension.Json.deps
      • ContentPipelineExtension.Json.dll
      • ContentPipelineExtension.Json.pdb

That’s all.

Interesting.
At first I asked if you build the extension for .net8, you said no.
I see that this is not the case. Or did you change it to .net6 and then back to .net8?

Build the extension for .net6 ** AND ** keep the PrivateAssets set to All.

1 Like

Hey yo!!! That was the solution to my initial problem, thanks a lot!

Now, when I run the program and try to load the JSON, I get the following error message:

Microsoft.Xna.Framework.Content.ContentLoadException: "Could not find ContentTypeReader Type. Please ensure the name of the Assembly that contains the Type matches the assembly in the full type name: ContentPipeline.Json.JsonContentTypeReader, ContentPipeline.Json (ContentPipeline.Json.JsonContentTypeReader, ContentPipeline.Json)"

This is the line that triggers it:

_contentManager.Load<TileType>("JSON/TileTypes/tileType_dirt");

The path of the JSON itself should be correct.

In the “JsonContentTypeWriter” class, the “GetRuntimeReader” method returns “ContentPipeline.Json.JsonContentTypeReader, ContentPipeline.Json”. Isn’t that correct?

no idea?

It’s looking for the ‘JsonContentTypeReader’ class, with namespace ‘ContentPipeline.Json’ in the assembly ‘ContentPipeline.Json.dll’. The error says that the class doesn’t exist.

You need to revisit the tutorial before proceeding any further.
First get a working project by following the steps precisely. After that start applying your changes and test often. Use a versioning control system to revert back if something goes wrong.

I’m sorry to bother you, but I cannot figure it out. I revisited the tutorial again, but it’s still broken.
I also added some more (unnecessary?) project references to force the compiler to build all dll’s, so they also exist in the bin folder now. But still the same error.
Please help me, I start to feel desperate.

Well, I think I will ignore the Content Pipeline from now on and write my own.

I ran into the same problem as you did.
The solution for me was just to roll everything back to .net 6 because the content pipeline extension, for some reason, doesn’t play nice with .net 8. Not the best way to solve it, but it works.

You can probably get away with setting only the extension to .net 6, but since mine was dependent on my other libraries, it wouldn’t let me (they have to be on the same version).