Home >Backend Development >C++ >How to Resolve 'Additional Configuration Information Required' Errors When Using Mixed-Mode Assemblies in .NET?
Referencing a .NET 2.0 mixed-mode assembly within a .NET 4.0 project can trigger an error demanding "additional configuration information." This stems from the inherent compatibility challenges of mixed-mode assemblies (combining managed and unmanaged code) when integrated into newer .NET frameworks.
The solution involves adjusting your application's configuration file (App.Config) by adding this element:
<code class="language-xml"><startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime sku=".NETFramework,Version=v4.0" version="v4.0"/> </startup></code>
The crucial setting is useLegacyV2RuntimeActivationPolicy="true"
. This directs the Common Language Runtime (CLR) to utilize the latest .NET version (4.0 in this case) for loading the mixed-mode assembly. Without this, the CLR defaults to the 2.0 runtime, resulting in the compatibility error.
This configuration is exclusively required for mixed-mode (C /CLI) assemblies. Purely managed CLR 2.0 assemblies don't necessitate these App.Config modifications. Furthermore, remember that altering this setting might affect performance; therefore, careful consideration is advised.
The above is the detailed content of How to Resolve 'Additional Configuration Information Required' Errors When Using Mixed-Mode Assemblies in .NET?. For more information, please follow other related articles on the PHP Chinese website!