Uselegacyv2runtimeactivationpolicy Crystal Reports

  1. In order to support.NET 2.0 Framework scenarios, the CR runtime components are compiled for.NET 2.0 framework support This issue occurs because the.NET Framework 4.0 loading behavior changed for mixed-mode components The issue does not exist with the.NET 3.5 Framework The.NET 3.5 and 4.0 Frameworks scenarios are tested and show full compatibility.
  2. After a bit of time (and more searching), I found this blog entry by Jomo Fisher. One of the recent problems we’ve seen is that, because of the support for side-by-side runtimes,.NET 4.0 has changed the way that it binds to older mixed-mode assemblies.
  1. Uselegacyv2runtimeactivationpolicy Crystal Reports Coronavirus
  2. Uselegacyv2runtimeactivationpolicy Crystal Reports Fire
Loading/running crystal report - Configuration markup 'startup' attribute useLegacyV2RuntimeActivationPolicy='true'

Jun 28, 2018 Could not load file or assembly 'file:///C: Program Files (x86) SAP BusinessObjects Crystal Reports for.NET Framework 4.0 Common SAP BusinessObjects Enterprise XI 4.0 win32x86 dotnet1 crdbadoplus.dll' or one of its dependencies.

gistfile1.txt
Exception: System.IO.FileNotFoundException was unhandled
Message: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'file:///C:Program Files (x86)SAP BusinessObjectsCrystal Reports for .NET Framework 4.0CommonSAP BusinessObjects Enterprise XI 4.0win32_x86dotnet1crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
<?xml version='1.0' encoding='utf-8' ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy='true'>
<supportedRuntime version='v4.0' sku='.NETFramework,Version=v4.5.2' />
</startup>
</configuration>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

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 )

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.

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 BusinessObjectsCrystal Reports for .NET Framework 4.0CommonSAP BusinessObjects Enterprise XI 4.0win32_x86dotnet

X64 his here:

C:Program Files (x86)SAP BusinessObjectsCrystal Reports for .NET Framework 4.0CommonSAP BusinessObjects Enterprise XI 4.0win64_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 Interopt 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:WindowsMicrosoft.NETassembly

Previous versions were placed in this folder:

C:Windowsassembly

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.

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 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:WindowsMicrosoft.NETassembly

the config file now has no references to the assemblies included:

Crystal

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:

Uselegacyv2runtimeactivationpolicy Crystal Reports Coronavirus

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:

Uselegacyv2runtimeactivationpolicy Crystal Reports Fire

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: