使用MonoGame的Content Manager加载XML时出错

问题描述 投票:1回答:1

我正在尝试尝试GeonBit.UI,当我去构建项目时,ContentManager为每个XML文件提供了这个错误:

[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)

我很确定它与MonoGame(3.7.1)有关,因为它也适用于非GeonBit.UI XML。有没有解决这个问题?

谢谢。

c# xml monogame
1个回答
0
投票

得到了community.monogame.net的答案

发生这种情况时,您可以删除.sprite文件旁边的.ttf文件,内容管道将找到它。您不需要将.ttf实际添加到内容项目中,它只需要住在spritefont旁边。

© www.soinside.com 2019 - 2024. All rights reserved.