Error when loading XML with MonoGame's Content Manager

时间:2019-04-08 13:22:01

标签: c# xml monogame

I'm trying to try out GeonBit.UI and when I go to build the project the ContentManager gives me this error for every XML file:

[PROJECT DIRECTORY]/Content/GeonBit.UI/themes/lowres/textures/slider_fancy_md.xml : error : Importer 'XmlImporter' had unexpected failure!
  System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
     at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
     at System.Reflection.Assembly.GetTypes()
     at System.Linq.Enumerable.<SelectManyIterator>d__23`3.MoveNext()
     at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
     at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
     at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.FindType(String typeName)
     at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T](ContentSerializerAttribute format, ContentTypeSerializer typeSerializer, T existingInstance)
     at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateReader.ReadObject[T](ContentSerializerAttribute format)
     at Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate.IntermediateSerializer.Deserialize[T](XmlReader input, String referenceRelocationPath)
     at Microsoft.Xna.Framework.Content.Pipeline.XmlImporter.Import(String filename, ContentImporterContext context)
     at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context)
     at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent)

I'm pretty sure it's with MonoGame (3.7.1) because it happens with non-GeonBit.UI XML's also. Is there a fix for this?

Thanks.

1 个答案:

答案 0 :(得分:0)

community.monogame.net上得到答案

  

发生这种情况时,可以将.ttf文件放在.spritefont文件旁边,然后内容管道会找到它。您无需将.ttf实际添加到内容项目中,只需将其放置在spritefont旁边即可。