Home > OS >  Failed to load file or assembly 'Microsoft.DirectX.DirectSound.dll' or one of its dependen
Failed to load file or assembly 'Microsoft.DirectX.DirectSound.dll' or one of its dependen

Time:03-25

My system: 64 bit

Visual Studio 2019 version.

When I search for DxDiag, it says: DxDiag, the screenshot is:

enter image description here

Unhandled Exception: System.BadImageFormatException: Failed to load file or assembly 'Microsoft.DirectX.DirectSound.dll' or one of its dependencies. is not a valid Win32 application.

CodePudding user response:

This seems to me like a straight clean compatibility issue with the DirectX dll. you are compiling in x86 instead of x64. Simply change the platform target to x86 in the project/properties page.

Let me know if this works for you.

CodePudding user response:

Microsoft.DirectX.DirectSound.dll is from the legacy Managed DirectX 1.1 assemblies. It is not installed by default on Windows, and is only available in the legacy DirectX SDK or using the legacy DirectX End-User Runtime redist package.

Those assemblies have been deprecated for many years and are not compatible with .NET 4.0, have no support for x64 or ARM64, and rely on additional legacy DirectX SDK components.

For C# access to DirectX, you should use something else. SharpDX, SlimDX, etc.

See this blog post.

  • Related