问题
I am getting the following error while running crystal report
CS0433: The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\windows\assembly\GAC_MSIL\CrystalDecisions.Web\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Web.dll' and 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\f8ac550c\d919c1f5\assembly\dl3\21892670\002d6cd3_f2bfc501\CrystalDecisions.Web.DLL
I am getting the above error after converting from framework 2.0 to 3.5. If I am creating new web application, I am not getting any error. I am getting error only for the converted application.
回答1:
Atlast I found.. The Problem is, In bin folder there is CrystalDecisions.Web.dll of version 10.2.51014.0 while i am adding reference i am adding 10.5.3700.0. So i have deleted dll from bin folder..Now Its working fine..
Thanks
回答2:
In case you compiled older Crystal Report Viewer dotNET project (2.0 or 3.5) in Visual Studio 2013 (dotNET 4.0 or 4.5) and get the same error, my solution is to specify in the web.config the binding redirect of Crystal DLLs to the specific version.
More info at:
MSDN: Redirecting Assembly Versions
Prerequsite: Installed SAP Crystal Reports, developer version for Microsoft Visual Studio, Support Pack 14 - v.13.0.14.1720 from the SAP support page
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Web" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.ReportAppServer.Controllers" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.ReportAppServer.DataDefModel" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692FBEA5521E1304"/>
<!-- Assembly versions can be redirected in app,
publisher policy, or machine configuration files. -->
<bindingRedirect oldVersion="10.0.0.0-12.0.0.0" newVersion="13.0.2000.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
回答3:
Try deleting both copies and reinstalling the runtime engine to clear all of this up.
回答4:
I am a web programmer and I work in version 2013 and crystal report. I am just solving this issue.
First you go your asp.net project then click bin folder then you see the crystal report dll save here. Delete all crystal report DLLs in the bin folder and then restart your project. That's it.
来源:https://stackoverflow.com/questions/7221194/cs0433-the-type-crystaldecisions-web-crystalreportviewer-exists-in-both