P. Avery
P. Avery

Reputation: 809

Cannot find ContentTypeReader

I have found a number of threads on this error but I haven't found a solution. I am using a number of class libraries from XNAExpert.com that are designed to animate a skinned mesh. I'm using XNA 4.0, Win Xp and programming games for Windows. Here is complete error:

Cannot find ContentTypeReader SkinnedModel.SkeletonReader, SkinnedModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

The tutorial can be found here . Here is the code from the reader class within SkinnedModel project:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace SkinnedModel
{
    public class SkeletonReader : ContentTypeReader<Skeleton>
    {
        protected override Skeleton Read(ContentReader input, Skeleton existingInstance)
        {
            List<Bone> boneList = input.ReadObject<List<Bone>>();
            return new Skeleton(boneList);
        }
    }
}

Here is the code from the writer class from within SkinnedModelProcessor project:

[ContentTypeWriter]
    public class SkeletonWriter : ContentTypeWriter<Skeleton>
    {
        protected override void Write(ContentWriter output, Skeleton value)
        {
            output.WriteObject(value.BoneList);
        }

        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return typeof(SkeletonReader).AssemblyQualifiedName;
        }
    } 

As you can see the type returned is the Assembly Qualified Name for each reader...Is anyone aware of another reason why I may be having trouble?

Upvotes: 0

Views: 1483

Answers (2)

Jaanus Varus
Jaanus Varus

Reputation: 3563

Solution for me was to just delete the ContentTypeReader and create a new one.

My problem seemed to be caused by having a mirrored project (I had Windows game library and Windows Phone game library). On Windows client the ContentReader was successfully found, but not on the Windows Phone client.

Upvotes: 2

Johannes
Johannes

Reputation: 6717

As i read it the SkeletonReader is known to the SkeletonWriter. I cannot think of a valid way to setup the projects so that this is true.

  • Project Main (Links To Content)
    • SkeletonReader
    • Skeleton

  • Project Content (Links To ContentExtendion)
    • SkeletonFile (Has Processor set to SkeletonProcessor)

  • Project ContentExtendion (Cannot link circular)
    • SkeletonContent (Is Input For Writer)
    • SkeletonWriter
    • SkeletonProcessor

Look at your ProjectSetup i think your assemblies are not linked correctly. And return a fixed string in GetRuntimeReader - if you setup the projects correctly you will loose the connection to the SkeletonReader.

There is a quite complete tutorial on the content pipeline on the interwebs.

Upvotes: 0

Related Questions