0

We are having a problem using DirectSound with the Managed DirectX dlls and the .Net Framework 4.0

The program works fine with .Net Framework 2.0 - but we have a requirement to upgrade to 4.0 to use some other components.

When the program invokes the Sound module, it crashes with the exception noted below.

Anybody seen this one and know how to fix it?

==============================================
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: 
Mike
  • 31
  • 4

3 Answers3

0

I know this is a late reply but for me to get this working I had to find two DirectX DLL Microsoft.DirectX and Microsoft.DirectX.DirectInput and add then as a reference to the project.

Then just use the DirectX namespace for calling methods.

Pimenta
  • 1,029
  • 2
  • 13
  • 32
  • This was eventually answered by a Microsoft employee from the DirectX team. The answer was: – Mike Aug 08 '13 at 20:11
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>
 -->
Mike
  • 31
  • 4
0

Officially the legacy DirectX Managed 1.1 assemblies do not support .NET 4.0. See this blog post for details.

You could look at using SlimDX or some other alternative...

mirh
  • 514
  • 8
  • 14
Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81