November 19, 2011

Crystal reports load report failed: Could not load file or assembly CrystalDecisions.Web, Version=10.2.3600.0


Recently we upgraded our Web Application Server to Windows Server 2008. After this, crystal reports in the VS2005 applications failed to load. This is because VS 2005 applications were using crystal report version 10.2.3600.0 which we can't install in Windows Server 2008. In the new server we can only install the crystal report version 10.5.3700.0. I had to follow the below steps to resolve this issue.

  1. Downloaded and installed new version of crystal report from the page below.
    http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=56787567
  2. Changed versions(10.2.3600.0 to 10.5.3700.0) in Web.Config and report viewer pages
  3. We removed all the crystal report reference from the project and tried to refer the new versions. But new versions were not displayed in the list. So I decided to take a local copy of these dlls and refer them. To do this run the below command(as Admin)
    regsvr32 -u C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\shfusion.dll
    The above command will help you to browse assembly folder as normal windows folders.
  4. Now go to C:\Windows\assembly and copy all the required dlls to some local folder and refer them.
  5. Now we were able to build the application successfully at this point, but it didn't work on the development machine. In the development machine, 2 versions of crystal reports still exists and we can't remove completely the 10.2.3600.0 version of crystal report which came as the part of bundled VS 2005.

    But when we put this files in the server where there is only one version of crystal report exists works perfectly.
  6. Then I updated the Crystal Report Version in the below file. It worked in some development machines, but issue still exists with my laptop(Windows 7).
    C:\Windows\Microsoft.NET\Framework\v2.0.50727\RedistList\CrystalReportsList.xml
  7. So I decided to completely remove 10.2.3600.0. To do this, run VS 2005 setup in the maintenance mode and specified to uninstall the crystal report component. Process completed without any error but still dlls exists in the assembly. Then I tried to uninstall through control panel same results. Grrrr..
    I tried to uninstall from assembly by right click and uninstall. This time I got an error message and dlls didn't remove from the assembly. Then I tried GacUtil tool to uninstall it but again failed with an error.
  8. Then I went to registry
    HKEY_LOCAL_MACHINE\Software\Classes\Installer\Assemblies\Global
    Found all the crystal report dll entries here. I deleted all the keys for the version 10.2.3600.0. Data is encrypted and value is REG_MULTI_SZ. Just delete all these keys.
  9. Now tried to uninstall dlls using GacUtil and finally it is worked and application also works perfectly in the development machine too. 

I am sure there will be much easier and correct way to resolve this issue. But unfortunately I couldn't find it when I required. Also there are some steps which you need not to follow, but I just wrote all the attempts that I made.

Note: Step 3: To take a local copy of dlls from assembly, you can use below program

using System;
using System.IO;

class Program
{
    static void Main(string[] args)
    {
        string[] sourceFiles = new string[]
        {
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.CrystalReports.Engine\10.5.3700.0__692fbea5521e1304\CrystalDecisions.CrystalReports.Engine.dll",
            @"C:\Windows\assembly\GAC\CrystalDecisions.Enterprise.Framework\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Enterprise.Framework.dll",
            @"C:\Windows\assembly\GAC\CrystalDecisions.Enterprise.InfoStore\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Enterprise.InfoStore.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.KeyCode\10.5.3700.0__692fbea5521e1304\CrystalDecisions.KeyCode.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ClientDoc\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ClientDoc.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.CommLayer\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.CommLayer.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.Controllers\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.Controllers.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.DataDefModel\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.DataDefModel.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.DataSetConversion\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.DataSetConversion.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.ReportDefModel\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.ReportDefModel.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportAppServer.XmlSerialize\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportAppServer.XmlSerialize.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.ReportSource\10.5.3700.0__692fbea5521e1304\CrystalDecisions.ReportSource.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Shared\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Shared.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Web\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Web.dll",
            @"C:\Windows\assembly\GAC_MSIL\CrystalDecisions.Windows.Forms\10.5.3700.0__692fbea5521e1304\CrystalDecisions.Windows.Forms.dll",
        };

        foreach (string file in sourceFiles)
            File.Copy(file, Path.Combine(@"C:\Temp\CrystalReportsAssemblies", Path.GetFileName(file)));
    }
}



After some days, exactly same error reappeared in my machine. Grrrrrrrr...This time by performing below steps I was able to resolve the issue. The problem I faced is while adding reference I point to new dlls of CR but it actually add reference of old 10.2.3600.0 instead of new 10.5.3700.0.
  1. Right click web app project and Click Properties.
  2. Remove reference path



Add reference again, it will add correct versions


No comments:

Post a Comment