CS0433: 类型“CrystalDecisions.Web.CrystalReportViewer”同时存在于“c:\Windows\assembly\GAC_MSIL\CrystalDecisions.Web\13.0.2000.0__692fbea5521e1304\CrystalDecisions.Web.dll”和
“c:\Windows\assembly\GAC_MSIL\CrystalDecisions.Web\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Web.dll”中
这是因为VS2010中水晶报表V13与VS2008中水晶报表V10版本冲突,导致程序在编译时无法正确定位到正确版本的DLL文件,在VS2010中,所有的DLL文件,都使用V13,具体解决方法如下:
(1)先检查web.config文件中关于程序集的引用,是否如下,是V13
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" />
</assemblies>
(2)在项目根目录下添加Bin文件夹,将C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet下的以下5个DLL文件复制到Bin文件夹下,
CrystalDecisions.CrystalReports.Engine.dll
CrystalDecisions.ReportSource.dll
CrystalDecisions.Shared.dll
CrystalDecisions.Web.dll
CrystalDecisions.Windows.Forms.dll
(3)最后将工具栏中,报表设计栏目下用到的控件拖拽到页面中,切换到HTML,将
改成
,控件就能够正常使用了