0

尝试为 XNA 编译 Content 项目时遇到了一点问题,

基本上,如果内容项目中没有任何内容,我可以编译并运行良好,但是当我添加任何类型的对象(图像、SpriteFont、纹理、模型)时,它不会编译并总是给出这个错误:

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

任何帮助都会很棒。

4

1 回答 1

0

完全删除 XNA 的任何痕迹,然后重新启动,然后尝试安装 XNA Game Studio 的新副本,为我解决了这个问题。

于 2013-10-09T20:48:37.447 回答