Search code examples
c#monogame

Monogame "Could not find ContentTypeReader Type"


How to fix this :

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: Microsoft.Xna.Framework.Content.ReflectiveReader1[[Microsoft.Xna.Framework.Content.Pipeline.Graphics.MaterialContent, MonoGame.Framework.Content.Pipeline, Version=3.8.0.1641, Culture=neutral, PublicKeyToken=null]] (Microsoft.Xna.Framework.Content.ReflectiveReader1[[Microsoft.Xna.Framework.Content.Pipeline.Graphics.MaterialContent, MonoGame.Framework.Content.Pipeline]])" ?


Solution

  • There is no MaterialContent in Monogame.dll, this is an internal base class of Pipeline. The writer fails to convert it to BasicMaterialContent because the Importer doesn't generate the correct object. The error is a bit misleading because the ReflectiveReader is for serializing items with no reader. It should say that MaterialContent doesn't exist. I've fixed that in my branch. Here's what you can do:

    1. Download ProtonType.Aether.v1.0.0.zip, from https://github.com/tainicom/ProtonType.Aether/releases/tag/v1.0.0 It's a stand alone building system for Monogame. Unzip it, run Protobuild.exe, open .mgcb and build the asset.

    2. Download and run custom build Monogame SDK from https://github.com/nkast/XNAGameStudio/tree/master/MG%20SDK This works as the SDK used by MonoGame prior to v3.8. Run Pipeline.exe from C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools open .mgcb and build your content.

      Make sure that the new xnb is not rebuild/overwritten, safest way to do that is to copy over the .xnb(s) (model & textures) to your Content folder , remove the stock processor and add the .xnb with action=Copy. or, if you installed the SDK , remove the 3.8 Build.Task nuget from the project and add the old target which builds content using the installed tools.