Search code examples
asp.netcrystal-reports

Getting "Could not load type" error after upgrading to latest Crystal Reports Runtime version 13.0.21.2533


We have a working application, ASP.NET Web forms that uses the Crystal Reports runtime and displays reports in an embedded Print Preview window. It is deployed on a Windows 2012 server and works with CR Runtime v13.0.18 and below.

Today we installed the latest Crystal Reports runtime version 13.0.21.2533 (downloaded from http://www.crystalreports.com/crvs/confirm/) and the Print Preview windows now raises this error:

Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'MyApp.printPreview1'.

Source Error:

Line 1: <%@ Control Language="vb" AutoEventWireup="false" CodeBehind="printPreview.ascx.vb" Inherits="MyApp.printPreview1" EnableViewState="true" %> Line 2: <%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %> Line 3: Source File: /MyApp/printPreview.ascx Line: 1

Rolling back to any version prior to v..21 seems to work OK but these older releases have disappeared from SAP/Crystal web site forcing us to use runtime v..21.

This is a breaking change that leaves all reporting in our application non-operational.


Solution

  • After reviewing the Crystal web site about this update here:

    https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads

    Specifically:

    Below items should be highlight for SP21:
    ...

    1. As most of CR/RAS .NET Assemblies are now re-versioned from 13.0.2000.0 to 13.0.3500.0, user MUST remove all old CR assemblies from Reference list and add the new version of CR assemblies, then rebuild the application.
      a. For those customer/user who do not wanted to rebuilt their application, there’s workaround to use <dependentAssembly> in app.config/web.config, please see attachment.

    I appears you must a) change your version references to 13.0.3500.0 in web.config and b) rebuild your application in Visual Studio.

    This isn't really a practical option for us as we have several in-place installs that will instantly break and a rebuild isn't straightforward with an in-production, live application.

    Instead we chose to use the dependentAssembly approach listed in point "4.a" above. Basically all we did was edit the web.config add this block:

      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.Web" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.Windows.Forms" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.ClientDoc" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonControls" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonObjectModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.Controllers" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.CubeDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataSetConversion" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.ObjectFactory" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.Prompting" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.ReportDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="CrystalDecisions.ReportAppServer.XmlSerialize" publicKeyToken="692fbea5521e1304" culture="neutral"/>
                <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
            </dependentAssembly>
        </assemblyBinding>
      </runtime>
    

    directly above the closing </configuration> tag, saved, and and the Print Preview window started working.

    This has been a viable workaround until we roll out a new release with the newer Crystal Runtime references built into the binaries.