编译内容项目时出错
本文关键字:出错 项目 编译 | 更新日期: 2023-09-27 18:34:23
尝试为XNA编译内容项目时遇到一些问题,
基本上,如果内容项目中没有任何内容,我可以编译并运行良好,但是当我添加任何类型的对象(图像,精灵字体,纹理,模型)时,它不会编译并且总是给出此错误:
Error 1 Building content threw InvalidCastException: Unable to cast object of type 'Microsoft.Xna.Framework.Content.Pipeline.Interop.RefDevice' to type 'System.IDisposable'.
at Microsoft.Xna.Framework.Content.Pipeline.CommonHelperFunctions.InitD3D()
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.InitD3D()
at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.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 Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAssetDirectly(BuildItem item, String importerName)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.ImportAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item)
at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild()
at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem[] sourceAssets, String[]& outputContent, String[]& rebuiltContent, String[]& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2[]& warnings) D:'Directory'Content'System'UI'Backgrounds'bg.png SolarFusion
任何帮助都会很棒。
完全删除XNA的任何痕迹,然后重新启动,然后尝试安装XNA Game Studio的新副本,为我解决了这个问题。