I have an old program made with Visual C# 2010. Now I would to use it again so I tried to compile on Visual 2017 Community but it launch an Exception on MicrosoftDirectSound. I understood that it's because is on 32bit so I would ask you if there is any workaround to implement that directx or alternatively what I have to use in the new scenario. I tried with "corflags" too, but it returns a warning about strong named signed.
System.BadImageFormatException: ... is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
Microsoft.DirectX.DirectSound
is part of the legacy Managed DirectX 1.1 assemblies. They only supported for the .NET 1.1 and .NET 2.0 Runtimes and not the modern .NET 4.x Runtime. You also as you note have to force the use of /platform:x86
.
Your best option is to use SlimDX which is intended as a drop-in replacement for the Managed DirectX 1.1 assemblies including x64 support. A more modern solution is SharpDX, but of course you probably shouldn't be using DirectSound in a new app anyhow.
See DirectX and .NET
The other thing to keep in mind is that the legacy DirectX Managed DirectX 1.1 assemblies are only installed by the legacy DirectX SDK or the deprecated DirectX End-User Runtime Redistribution Package on systems with the .NET 2.0/3.x Runtime enabled. See Not So DirectSetup and DXSETUP Update.
User contributions licensed under CC BY-SA 3.0