尝试为XNA编译Content项目时遇到一些问题,
基本上如果内容项目中没有任何内容,我可以编译并运行正常,但是当我添加任何类型的对象(Image,SpriteFont,Texture,Model)时,它不会编译并且总是会出现此错误:
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
任何帮助都会很棒。
答案 0 :(得分:0)
完全删除XNA的任何痕迹,然后重新启动,然后尝试安装XNA Game Studio的全新副本,为我修复此问题。