I am migrating an XNA project and am trying to load a model .xnb built with the XNA content pipeline, because I don’t have a working MonoGame pipeline yet.
I placed the .xnb file together with the texture .xnb files in the output dir.
When I call
Model = content.Load<Model>("Models\\sentry_idle");
I get the error:
An unhandled exception of type ‘Microsoft.Xna.Framework.Content.ContentLoadException’ occurred in MonoGame.Framework.dll
Additional information: Could not load Models\sentry_idle asset as a non-content file!
Is it possbile at all…?
The inner exception should contain more detail on what specifically went wrong.
The error is that the reader class for animations cannot be found:
Could not find ContentTypeReader Type.
Please ensure the name of the Assembly that contains the Type matches the assembly in the full type name:
Xclna.Xna.Animation.Content.AnimationReader, Xclna.Xna.Animationx86, Version=220.127.116.11, Culture=neutral, PublicKeyToken=null
So the content load has successfully started to load the model and is reading the type name of the class (AnimationReader) that is used to read in animations contained in the file. But it fails to locate the class/type.
The weird thing is that when I view the animation dll in the Object Browser, the AnimationReader class is missing as well as a lot of other classes. But, this is also the case in the XNA project which works fine…
Did you add a reference to the Xclna assembly in your project? That is not a standard XNA assembly.
Yes, there is a reference to the runtime animation project, I build it from source in the same solution as the game.
I had forgot to copy the assembly info, including the assembly version number, to the migrated project. After doing that, I still get the same error.
I also forgot to set the assembly name on the properties page of the migrated project. After doing so, the error went away.
As you have found, everything needs to match the fully-qualified type name: namespace, type name and assembly name.
Correct, I also posted to verify whether what I was trying to do was possible at all. The models and animations seem to work for now, so I am moving on to the rest of the issues. Thanks.