在Visual Studio 2010的WinForm中使用水晶报表运行错误—— 未能加载文件或程序集

来源:互联网 发布:mysql中undo是什么 编辑:程序博客网 时间:2024/04/28 07:01

Visual Studio 2010使用水晶报表的版本为:13.0.0.99。在C#的WinForm应用程序中加入水晶报表并编译运行,运行期间为ReportDocument变量rd绑定数据表时出现错误:


未能加载文件或程序集“file:///C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll”或它的某一个依赖项。系统找不到指定的文件。

在查找了很多资料之后,找到了解决问题的办法,如下:

在 App.Config里面自动生成了一段对Startup的设置:

<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
将上述代码更改为:

<span style="color:#333333;"><startup </span><span style="color:#ff0000;">useLegacyV2RuntimeActivationPolicy="true"</span><span style="color:#333333;">>    <span style="white-space:pre"></span><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration></span>
重新编译即可运行,但不知道为什么出现这个错误。好像这个错误在webForm类型的程序中就不会出现

0 0