Upgrading a Visual Studio 2008->2019 .NET project with the latest CR .NET SDK packages
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
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.xxxx.x can no longer access BusinessObjects Enterprise Servers, you need to use the BOE .NET SDK packages now. ( See above for that blog )
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.
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:
- Object Factory is missing
- Prompting is missing
- Copy Local may be True or False
- Embedded Interopt Types may be true or false
- Path is to the physical location of the dll’s
- 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 Interopt 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 Interopt 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.
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 Interopt 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 interopt 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
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:
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