1. Refer to the 2 files of Microsoft.DirectX.dll and Microsoft.DirectX.Directsound.dll.
2. Project attribute inside, change target platform to X86.
3.app.config modified under:
1 <?XML version= "1.0"?>2 <Configuration>3 <StartupuseLegacyV2RuntimeActivationPolicy= "true"> 4 <supportedruntimeversion= "v4.0"SKU=". netframework,version=v4.0 "/>5 </Startup>6 </Configuration>
Using the Dirext3d managed library under. NET 4.0, the "mixed-mode assembly was generated for the v1.1.4322" version of the runtime and cannot be loaded in the 4.0 runtime without additional information being configured. "Exception information, view the assembly Microsoft.DirectX.dll, Microsoft.DirectX.Direct3D.dll, Microsoft.DirectX.Direct3DX, and discover its. NET The runtime version is v1.1.4322, which means that the D3D managed library was built under the. NET v1.1 version.
In. NET4.0 before, due to the nature of the program operating environment or. NET2.0, and. NET2.0 compatible. NET1.0 and 1.1, but when you upgrade to. NET4.0, the. NET kernel makes significant adjustments to assemblies that were previously generated in. Net2.0 or. net3.5, if you want to run under. net4.0, You need to specify the common language runtime version supported by this application in the configuration file and enable the. NET Framework 2.0 Runtime Activation policy, the appropriate app. config is as follows:
1 <?XML version= "1.0"?>2 <Configuration>3 <StartupuseLegacyV2RuntimeActivationPolicy= "true">4 <supportedruntimeversion= "v4.0"/>5 </Startup>6 </Configuration>
Reference from MSDN, specific address: http://msdn.microsoft.com/zh-cn/library/bbx34a2h.aspx
Turn from: http://blog.csdn.net/shenyc/article/details/7872300
Go to C #. NET4.0 mixed-mode assembly exception