我正在向项目添加库,但收到以下错误:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
我不太确定我必须调整什么才能让它运行。有人知道应该进行哪些更改吗?
谢谢
下午
最佳答案
正如 Marc 所说,理想情况下您应该在 .NET 4 中重建,或使您的项目面向 .NET 3.5 或更低版本。为 v2 CLR 构建的混合模式程序集使用“旧版”运行时激活技术,该技术与 v4 CLR 在同一进程中运行多个 CLR 的能力不能很好地配合。
或者,您可以将此信息添加到您的 app.config 中:
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>
参见this question , this documentation还有这个blog post了解详情。
关于c# - Visual Studio 添加 DLL 作为引用错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4311274/