vs2015在单元测试的时候报错:
用户代码未处理 System.IO.FileLoadException
HResult=-2146232799
Message=混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法在 4.0 运行时中加载该程序集。
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.
解决方法:
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools(If you dont find this file, create and add one)
创建sgen.exe.config,内容如下:
<?xml version ="1.0"?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
</configuration>
本文解决VS2015进行单元测试时出现的System.IO.FileLoadException错误,提供详细步骤,涉及.NET Framework版本冲突,通过创建sgen.exe.config文件并设置useLegacyV2RuntimeActivationPolicy参数来解决。

被折叠的 条评论
为什么被折叠?



