【发布时间】:2011-09-19 12:31:54
【问题描述】:
我收到以下异常:
混合模式程序集是针对运行时版本“v2.0.50727”构建的,如果没有额外的配置信息,则无法在 4.0 运行时中加载。
当我试图从我的 WPF 程序中导出水晶报表时...
我已经在 app.config 中添加了以下内容...
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
有高手可以帮忙吗???
我找到的参考资料: http://www.davidmoore.info/2010/12/17/running-net-2-runtime-applications-under-the-net-4-runtime
【问题讨论】:
-
重要提示:如果错误发生在错误列“文件”为
SGEN,则修复需要位于sgen.exe.config旁边的文件sgen.exe中。例如,对于 VS 2015,创建C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\sgen.exe.config。来源:SGEN Mixed mode assembly 最小文件内容:<configuration><startup useLegacyV2RuntimeActivationPolicy="true"/></configuration> -
请注意,您可能不仅有“C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6 Tools\”,而且在此之下,还有一个 'x64 ' 目录,该目录也有一个 sgen.exe,可能还有其他几个 sgen 副本/版本都在不同的路径中,具体取决于您安装的 VS 的数量和版本。
-
@ToolmakerSteve 请发表您的评论作为答案,以便我投票;其他答案都没有帮助我。
-
@Malcolm - 好的,posted as an answer
标签: .net visual-studio-2010 .net-4.0 ado.net crystal-reports