使用DirectSound和Managed DirectX dll以及.Net Framework 4.0时遇到问题
该程序可以与.Net Framework 2.0一起使用 - 但是我们需要升级到4.0才能使用其他组件。
当程序调用Sound模块时,它会因下面提到的异常而崩溃。
有人看过这个,知道如何解决它吗?
==============================================
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:
答案 0 :(得分:0)
我知道这是一个迟到的回复但是为了让我能够工作,我必须找到两个DirectX DLL Microsoft.DirectX
和Microsoft.DirectX.DirectInput
,然后添加它作为项目的参考。
然后只使用DirectX名称空间来调用方法。
答案 1 :(得分:0)
<!-- 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>
-->
答案 2 :(得分:0)