Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 

Purpose


To assist Project Developers upgrading an older project with the latest Service Packs of Crystal Reports for Visual Studio.

Note: I'm currently using SP 29

Update for VS 2022 added

Overview


When upgrading existing project to the latest CR for VS runtime there are a few things you need to do after first opening your project. Visual Studio does not do a complete upgrade of the CR Assemblies.

CR for VS minimum Framework version is based on the version noted:

13.0.2000.0 = 2.0 Framework

13.0.3500.0 = 3.5 Framework

13.0.4000.0 = 4.x Framework

With SP 29 we recommend using 4.7.2

Note: see this Blog for upgrading BOE, CRS, CRS (OEM) .NET projects

Uninstalling the previous version


If upgrading from CR 2008 runtime, note the runtime is no longer in the BusinessObjects folder.

If your original project is using CR SPxx runtime, then the first thing you need to do is download the latest SP which you can get from here

Note: As of CR 2011 we no longer install the .NET runtime with CR Designer, ALL runtime for CR 2011 and above is CR for VS

Note: Version 13.0.1111.x can no longer access BusinessObjects Enterprise Servers, you need to use the BOE .NET SDK packages now. ( See above for that blog )

Uninstall any older MSI’s and the EXE installed on your Development PC, in the screen shot below I have updated already:


Note: the runtime... (64-bit) is an option when installing CR for VS, last step.

Uninstall the 64 bit first and then the main package last. and any other CR runtime, no longer required. You can still have CR 2008 and previous but CR for VS can only have one version (13) installed.

VS 2008 will not use CR for VS, you need to upgrade to VS 2010->2019.

Installing the latest SP


Run the SP 29 EXE to integrate into Visual studio by right clicking on the EXE and selecting Run as Administrator, this is must due to Windows security and to properly register the COM dll's and Registry Keys we create. At the end of the install it prompts to install the 64 bit runtime, click OK.

Example for SP 29 - https://origin.softwaredownloads.sap.com/public/file/0020000001636412020

Use the MSI’s ONLY for distribution, not required to be install on your Development PC.

Also not recommended using the MSI's because the MSI's will not integrate into Visual Studio, no CR Projects are available in the Project Wizard.

On rare occasions you may want to re-boot your PC, sometimes the runtime is "locked" and a reboot is required to finish the update. And a Repair may need to be done.

VS 2022 is a 64 bit interface so the default project is x64.

CR for VS SP 32 has two installers:

CR for Visual Studio SP32 32b installer (VS 2019 and below)

CR for Visual Studio SP32 64b installer (VS 2022 and above)

Note: the embedded Report Designer (CR Basic) has been upgraded to 64 bits, there have been one issue reported:

KBA 3209106 - Crystal Reports for Visual Studio 2022 - object Copy/Paste does not use original objects size properties when pasting

Now that you have the runtime updated here is an example of what you may run into.


THE APPLICATION example:


You will find the CR dll's here, I recommend using the .NET tab or Extensions when adding them to your project, much cleaner:

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet

X64 his here:

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win64_x64

Open your Project, in this instance the app was created in VS 2010 and now opening in VS 2019:


You have the option to backup, I suggest making a copy first and not making a backup, but it's up to you how you manage the old and new versions.

Now change your Framework version to 4.7.2:


And the platform to either x86 or x64, it's on the Build* list. CR runtime is configured for your application platform and not the OS.

Now check the references.

To upgrade your references, first take a screen shot of your existing assemblies:


Delete them all unless they point to the latest version 13.0.4000.0.

Now you need to add the new Assemblies, VS doesn’t seem to work very well at updating them but depends on versions.


 

A few things to note on this screen:

  1. Object Factory is missing

  2. Prompting is missing

  3. Copy Local may be True or False

  4. Embedded Interop Types may be true or false

  5. Path is to the physical location of the dll's

  6. Assembly version is 13.0.4000.0, not the actual file version.


Add the new Assemblies by clicking on the Extension option, Do NOT browse to the files, much cleaner using the VS interface into the GAC

Note the full path and it’s pointing to the x86 folder, because VS is a 32 bit application select x86 first.

As you add each one confirm they are all from the x86 folder, he may see the path to the X64 folder listed.

Note: as of SP 29 we now register the Assemblies into GAC using this folder:

C:\Windows\Microsoft.NET\assembly

Previous versions were placed in this folder:

C:\Windows\assembly

After you have updated the Assemblies set the Interop to True or False, depends on the assemblies added as to which it is set to, when building the project you will get a message if the Assembly needs to have the Interop changed.

And change the Copy Local to False, the reason is if you update your runtime you want the application to load from our folders/GAC, having the files copied to your \bin folder can cause runtime issues because of mixed version.

Also note: when changing to X64 in the project references will still point to the x86 folder, when distributed it will use the x64 versions.

Now you may have issues with the CR Windows Form Viewer.

To add the new CR Windows viewer right click on the ToolBox and select Choose Items....


Now you'll see the CR viewer in the Toolbox list and note it should be version 13.0.4000.0:


 

You may get some kind of error so you may have to re-add the Viewer to your Form.

Ready to build THE APPLICATION:


Ok, now that we have all of the references, mostly, updated it's time to rebuild your project.

Click on the Build menu and select Rebuild...

Here's where you'll get the Embedded Interop messages:


Note, they are warnings, if one does need it changed it will show up as an Error.


Mostly the RAS components will need the interop set to true.

So depending on what parts you are using depends on the setting, keep trying until it runs.

Updating THE APPLICATION app.config file:


OK so now that the app is built it's time to possibly fix your app.config file.

Previous to SP 29 the config file included the CR assemblies.

Since we changed the location of the Assemblies to here, C:\Windows\Microsoft.NET\assembly

the config file now has no references to the assemblies included:
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="businessObjects">
<sectionGroup name="crystalReports">
<section name="crystalReportViewer" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</sectionGroup>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">

<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<!-- <assemblyIdentity name="System.Web.Services" publicKeyToken="B03F5F7F11D50A3A" culture="neutral"/> -->
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<!--
<businessObjects>
<crystalReports>
<crystalReportViewer>
<add key="AntiAlias" value="true"/>
</crystalReportViewer>
</crystalReports>
</businessObjects>
-->
</configuration>

 

If you were using the ADO.NET(XML) client DB driver due to legacy changes in older versions you had to redirect to use Legacy mode.

Since SP 21 this is no longer required so remove this from your Config file if it exists:
<startup useLegacyV2RuntimeActivationPolicy="true">

Web Application:


To upgrade your WEB app do the same as above, add the CR WebForm viewer to the tool bar and then drag and drop it onto his web page. Delete the old one first.

Next to resolve any version issues open the web.config in your project and verify they are all 13.0.4000.0

Example below:
<?xml version="1.0"?><!--

For more information on how to configure your ASP.NET application, please visit

https://go.microsoft.com/fwlink/?LinkId=169433

--><configuration>

<appSettings>

<add key="CrystalImageCleaner-AutoStart" value="true" />

<add key="CrystalImageCleaner-Sleep" value="60000" />

<add key="CrystalImageCleaner-Age" value="120000" />

</appSettings>

<system.web>

<compilation debug="true" targetFramework="4.7.2">

<assemblies>

<add assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.Shared, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportSource, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>

<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></assemblies>

</compilation>

<httpRuntime targetFramework="4.7.2"/>

<httpHandlers><add verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/></httpHandlers></system.web>

<system.codedom>

<compilers>

<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701"/>

<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+"/>

</compilers>

</system.codedom>

<system.webServer><handlers><add name="CrystalImageHandler.aspx_GET" verb="GET" path="CrystalImageHandler.aspx" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" preCondition="integratedMode"/></handlers><validation validateIntegratedModeConfiguration="false"/></system.webServer></configuration>

 

A quick test using this to start with.

Create a new Project and select empty, select the Crystal Reports, (NOT the MS Report project) in the webform1.aspx it should look something like this:

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportSource;

namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new ReportDocument();
rpt.Load(@"D:\Atest\report1.rpt");
CrystalReportViewer1.ReportSource = rpt;
}
}
}

 
6 Comments