How to resolve Crystal Report version conflict and

2020-07-09 16:15发布

问题:

I have VS-2005 and VS-2010 installed. As Crystal Reports is available as a separate download for VS-2010, I downloaded it and installed. My old projects were in VS-2010 which uses Crystal Reports version 10.0. New projects are in VS-2010 whose Crystal Reports version is 13.0.

I made a small application in VS-2010 with a single report. When I try to run this project, it displays errors:

The type 'CrystalDecisions.Web.CrystalReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\CrystalDecisions.Web\10.2.3600.0__692fbea5521e1304\CrystalDecisions.Web.dll' and 'c:\Windows\assembly\GAC_MSIL\CrystalDecisions.Web\13.0.2000.0__692fbea5521e1304\CrystalDecisions.Web.dll'

The indirectly-referenced assembly 'BusinessObjects.Licensing.KeycodeDecoder, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be found. This assembly is not required for analysis, however, analysis results could be incomplete. This assembly was referenced by: C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\13.0.2000.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll.

I can't uninstall old Crystal Reports (i.e., version 10). How to make these work side-by-side and what changes are required in GAC and web.config files.

回答1:

This is a known issue with Crystal Reports. It doesn't do well with side-by-side versions in the GAC.

From SAP:

As each version of Crystal Reports has its' own specific runtime which must be correctly deployed, it is critical that the deployed runtime be in agreement with the Crystal Reports assemblies for Visual Studio .NET referenced in your project.

Use gacutil /u /f to forcefully uninstall the older Crystal Reports assemblies.

If it doesn't let you must uninstall Crystal Reports for Visual Studio 2005.

You can still keep side-by-side projects by copying the assemblies to a shared folder (e.g. '..\3rdParty\10.5.3700.0' and do a file reference to that folder instead of the GAC. The trick is to copy the Crystal Reports assemblies from the GAC via commnadline:

> copy c:\WINDOWS\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\10.5.3700.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll c:\dev\3rdParty\10.5.3700.0

To discover which assemblies are deployed:

gacutil /l

Then you simply uninstall the copied assemblies from the GAC.