views:

544

answers:

2

Our project currently uses Crystal Reports for Visual Studio 2008. We need to upgrade to XI R2, but I'm having problems doing so. Here are the steps I followed:

  1. Install Crystal Reports XI R2.
  2. Collect updated assemblies from the GAC. I did this because I couldn't find version XI libraries in the "Add References..." dialog. I verified that these assemblies were of version 11.5.*. The libraries I gathered were:
    • CrystalDecisions.CrystalReports.Engine
    • CrystalDecisions.Enterprise.Framework
    • CrystalDecisions.Enterprise.InfoStore
    • CrystalDecisions.ReportSource
    • CrystalDecisions.Shared
    • CrystalDecisions.Windows.Forms
  3. Replace all references in my projects to version 10.5 Crystal libraries with references to the newer assemblies.

Everything builds fine, but when I try to instantiate a ReportDocument, I get this error:

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception.

Is there anything I'm missing? Will this just not work?

+1  A: 

-Uninstall Crytal Report 2008 from conttrol panel programs.

-Reboot your PC

-Then Add the Reference Tab browse to this path C:\Program Files\Business Objects\Common\3.5\managed\dotnet2 and select the Dll for the solution

-Add this code to test de references

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Dim rptDocument As ReportDocument
    rptDocument = New ReportDocument()

    Dim reportPath As String = Application.StartupPath & "\" & "CrystalReport1.rpt"
    rptDocument.Load(reportPath)

    Me.myCrystalReportViewer.ReportSource = rptDocument

End Sub


Private Sub myCrystalReportViewer_ClickPage(ByVal sender As Object, ByVal e As CrystalDecisions.Windows.Forms.PageMouseEventArgs) Handles myCrystalReportViewer.ClickPage
    Debug.Print(e.ObjectInfo.Text)
End Sub
Bitnius
Are you saying that by uninstalling Crystal Reports XI R2, you were able to instantiate a `ReportDocument` using the XI R2 libraries? This answer is confusing.
Stuart Branham
Do not uninstall CR XI R2.You must uninstall Crystal Report 2008 from control panel -> programs.with this procedure I get to work fine Crystal Report XI R2, but you have to change all reference to new CR dlls.this new version of Crystal Report XI R2 do not have any integration with VS 2008 IDE. you have to design or modify the reports file ( .rpt ) in Crystal Report XI R2 IDE.Greetings
Bitnius
That clears everything up! Unfortunately, this didn't work for me. :( The VS integration I don't really care about - just executing reports using the XI R2 runtime/libraries.
Stuart Branham
What exception was throw?
Craig
The exception message is in the question. The type of the exception is `TypeInitializationException`.
Stuart Branham
At the Reference Tab browse to this path C:\Program Files\Business Objects\Common\3.5\managed\dotnet2and select the Dll for the solution.
Bitnius
Stuart-Did you install the XI R2 Report Viewer control? I believe it is in a different assembly that what you have listed. At this point, you may be using the 10.5 assembly to view a 11.5 report.
Craig
@Craig Nope, so that is a distinct possibility. I can't seem to find anything about this control on Business Objects' web site, however.
Stuart Branham
@Craig I'm not so sure now, since apparently I forgot that I can't get past instantiating a ReportDocument. I'm sure I would have run into a problem with the control eventually though, so thanks for preempting that! :)
Stuart Branham
+1  A: 

If I understand your question, you can't upgrade to CR XI R2 and use it with VS 2008. The highest supported version for XI R2 is VS 2005. I think you will have to upgrade the CR product to CR 2008.

CharlieG
So, this includes just displaying reports as well? I know the report designer doesn't work, but the bare minimum is more of what I'm asking about.
Stuart Branham
I'm pretty sure. I blew a whole day researching this (thanks SAP) and did come up with this useful link: http://wiki.sdn.sap.com/wiki/display/BOBJ/Which%20Crystal%20Reports%20assembly%20versions%20are%20supported%20in%20which%20versions%20of%20Visual%20Studio%20.NET . Please let us know if you find differently.
CharlieG
Honestly this is good enough for me. I've spent way too much time on this crap!
Stuart Branham
Gah. Apparently I can't accept this answer. The bounty period must have expired or something.
Stuart Branham
amen to that brotha! Ouch to the points...I need them!
CharlieG