首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在.Net Framework4.0中使用托管DirectX时程序崩溃

在.Net Framework4.0中使用托管DirectX时程序崩溃
EN

Stack Overflow用户
提问于 2012-06-23 02:46:14
回答 3查看 2.1K关注 0票数 0

我们在使用带有托管DirectX dlls和.Net Framework4.0的DirectSound时遇到问题

该程序在.Net Framework2.0上运行良好-但我们要求升级到4.0才能使用其他一些组件。

当程序调用Sound模块时,它会崩溃,并出现下面提到的异常。

有人看过这个并知道如何修复它吗?

代码语言:javascript
复制
==============================================
System.IO.FileNotFoundException was unhandled
Message=Could not load file or assembly 'Microsoft.DirectX, Version=2.0.0.0, Culture=neutral,    PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source=Microsoft.DirectX.DirectSound
FileName=Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
FusionLog=""
[stack dump snipped]
InnerException: System.IO.FileNotFoundException
Message=Could not load file or assembly 'Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
FileName=Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35

FusionLog==== Pre-bind state information ===
LOG: User = *****************
LOG: DisplayName = Microsoft.DirectX, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/Users/*********/Documents/Visual Studio 2010/Projects/************/bin/x86/Debug/
LOG: Initial PrivatePath = NULL

Calling assembly : Microsoft.DirectX.DirectSound, Version=1.0.2902.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\***********\Documents\Visual Studio 2010\Projects\****************\bin\x86\Debug\***************.exe.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Redirect found in application configuration file: 1.0.2902.0 redirected to 2.0.0.0.
LOG: Post-policy reference: Microsoft.DirectX, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
InnerException: 
EN

回答 3

Stack Overflow用户

发布于 2013-02-16 00:51:21

我知道这是一个迟来的回复,但对于我来说,为了让它正常工作,我不得不找到两个DirectX DLL,Microsoft.DirectXMicrosoft.DirectX.DirectInput,然后添加作为项目的引用。

然后只需使用DirectX名称空间来调用方法。

票数 0
EN

Stack Overflow用户

发布于 2013-08-09 04:14:41

代码语言:javascript
复制
 <!--  Uncomment this section when switching from Net2.0 to Net 4.0 
  It is intended to fix problems loading DirectX dlls  - per Microsoft-->

 <!-- 

  <startup useLegacyV2RuntimeActivationPolicy="true">
  <supportedRuntime version="v4.0"/>

   </startup>
 -->
票数 0
EN

Stack Overflow用户

发布于 2014-06-27 03:28:56

按照官方说法,遗留的DirectX Managed 1.1程序集不支持.NET 4.0。有关详细信息,请参阅此blog帖子。

您可以考虑使用SlimDX或其他替代方案...

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11162300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档