Crystal Reports 2010 Errors

Posted by Blake on 3/1/2012
)

Scenario:

You install Crystal Reports 2010 to use with Visual Studio 2010. You create a “Crystal Reports Application” project from the “New Project” dialog in Visual Studio. Without adding any code, you compile and receive the below errors.

  • Error 2 Reference required to assembly 'CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' containing the type 'CrystalDecisions.Shared.RequestContext'. Add one to your project. C:UsersHiAppDataLocalTemporary ProjectsCrystalReportsApplication1CrystalReport1.vb 99 16 CrystalReportsApplication1
  • Error 1 Reference required to assembly 'CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' containing the type 'CrystalDecisions.CrystalReports.Engine.ReportDocument'. Add one to your project. C:UsersHiAppDataLocalTemporary ProjectsCrystalReportsApplication1CrystalReport1.vb 99 16 CrystalReportsApplication1

The problem as far as I can tell occurs when you also have Crystal Reports 2008 installed on the same machine (which is the one that is packaged with Visual Studio 2008). Whenever the Crystal Reports 2010 application is created with VS2010, it (as far as I can tell) incorrectly references some of the old assemblies. SAP’s suggestion is to uninstall Crystal Reports 2008 which isn’t always a feasible option (which is to say, can be a huge headache when you also need that). Anyway, here’s a quick fix for you that should work.

  1. In the Visual Studio Solution Explorer, click the button to “Show All Files”. You will now see the “References” node.
  2. Expand the references node, delete all of the “CrystalDecisions” references.
  3. Right click on “References” and choose “Add Reference”.
  4. Select the 4 references you deleted but make sure they are the version 13 copies (in my case, 13.0.2000.0 which for whatever reason target the .Net Framework 2.0 even though they’re labeled as 4.0 assemblies).
  5. Compile your project, it should compile/run now.

I was lazy in testing, so I added references to every version 13 CR assembly, I assume just replacing the 4 needed would do the trick.

One final note/rant. The “.Net Framework 4.0” assemblies for CR actually target the 2.0 framework and the template project also uses a “FlashControlV71” assembly that targets the 1.1 framework. This means, even if I’m writing a 4.0 application, I have to have the 2.0 framework and the 1.1 framework on the workstation/server executing this program. Mainstream support ended on 1.1 in 2008 and extended support ends in October of 2013. I have to wonder why these controls haven’t been updated and why they’re still being shipped. If you’re going to target 4.0 with your product, target 4.0 so there’s only one framework involved. In this case, these are 3 totally different versions of the CLR required (1.1, 2.0 and 4.0).