Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem in using the directX components in wpf application. If I don't use any DirectX components then there's no problem and the window will be loaded. If I include the DirectX component and create an object, then the window is not loading and giving an exception:
{"Mixed mode assembly is built against version 'v1.1.4322' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.":null}

Whichever DirectX component I use I have the same problem. Here is my code:
C#
private void Window_Loaded(object sender, RoutedEventArgs e)
{
     Microsoft.DirectX.DirectSound.Device dev = new Microsoft.DirectX.DirectSound.Device();
     MessageBox.Show("HI");
}
Posted
Updated 12-Feb-14 23:40pm
v2

1 solution

Add an app.config file to your project if you don't have one already in place. In this file, you need to add:
C#
<configuration>
  <startup useLegacyV2RuntimeActivationPolicy="true" />
</configuration>
This tells .NET 4 to allow Mixed Mode[^] CLR 2 assemblies.
 
Share this answer
 
Comments
Member 10168312 13-Feb-14 6:25am    
Thanks.. but it didnt solve my problem....
if i put a break point in window_loaded event, it is also not hitting....
please tell how to use the directx components in wpf...
Pete O'Hanlon 13-Feb-14 6:36am    
Check that the configuration file has copied to your output directory - it will have been renamed as exename.exe.config where exename is the name of your executable.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900