Crystal Reports and Visual Studio 2010

Visual Studio(VS) editions older than VS2010 had Crystal Reports(CR) included out of the box. Unfortunately, the relationship between Microsoft and SAP ended with Visual Studio 2010 so when you open it up you will notice that there is not any CR tools.

Even though CR is not included with VS, you can still download CR for VS2010, for free, as a separate install. You can find the download here: http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp

You will want to use the first link: SAP Crystal Reports, version for Visual Studio 2010 – Standard (MAKE SURE YOU HAVE VS2010 INSTALLED FIRST!)

Now, any project that you compile inside VS2010 that uses CR will use the new version of Crystal, even if the project was originally built in VS2008 or prior. This means that our customers will be required to have SAP Crystal Reports runtime engine for .NET Framework 4 installed on their computers. This is true no matter what .NET Framework you use to build your project. The 32bit and 64bit client runtimes are available at the link provided above.

***NOTE*** It will be understood why in a minute, but we will call the new version of CR “Version 13” and the old version “Version 10”.

Version 13 and Version 10 do install nicely side-by-side, and they play nice together also. The big problem here is that Version 13 does require an administrator to physically log onto Windows to install (I can’t remember which, but between Windows XP and Windows 7 one required the admin to log-on and the other allowed the admin to right-click and choose “Run As”. Both OS’s give the option, but it only works on one.) Additionally the install takes well over 30 minutes to complete and as far as I know there is not a silent install available.

If you don’t need any of the features of Version 13, you can still use Version 10; here’s how.

If you are not using the Crystal Report Viewer control (for example, you are just using the ReportDocument class in your code) then you can just reference the Version 10 Dlls. Instructions follow for both Visual Basic and C#:

  • Visual Basic
    1. Right-click on your project file and go to properties
    2. Go to the Reference Tab
    3. Make a note of all references listed that begin with CrystalDecisions and are of Version 13 and higher
    4. Select the CrystalDecisions with a version of 13 and higher and click the Remove button
    5. Click the Add Button
    6. Select the .Net Tab
    7. Select the Version 10 versions of the CrystalDecisions dlls that you need
    8. Click OK
  • C#
    1. In solution explorer expand the References folder
    2. Make a note of all references listed that begin with CrystalDecisions and are of Version 13 and higher
    3. Select and delete the CrystalDecisions with a version of 13 and higher
    4. Right-Click the References folder and select Add Reference
    5. Select the .Net Tab
    6. Select the Version 10 versions of the CrystalDecisions dlls that you need
    7. Click OK

Now, if you do want to use the Crystal Report Viewer you can still use the old dlls. Here is how:

  1. Add the Crystal Report Viewer control to your web form
  2. Open the designer file for your form
  3. Comment out the following lines in C# or VB respectfully
    • C#
      1. this.CrystalReportViewer1.EnableRefresh = false;
      2. this.CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
      3. this.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;
    • VB
      1. Me.CrystalReportViewer1.EnableRefresh = False
      2. Me.CrystalReportViewer1.ReuseParameterValuesOnRefresh = True
      3. Me.CrystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None

If your project is using ClickOnce then don’t forget to remove the prerequisite for “SAP Crystal Reports Runtime Engine for .NET Framework 4.0”

***NOTE*** during my testing and preparation of this tutorial, I found that after I told VS2010 to use the Version 10 dlls for one project, it sometimes used them for new projects by default.

When opening your project again VS2010 wants to be helpful and upgrade CR for you.

When this happens, just choose Open the solution without conversion and press OK:

And that’s it, now you are using Crystal Reports with Visual Studio 2010!

Advertisements

18 thoughts on “Crystal Reports and Visual Studio 2010

  1. Usually I don’t read post on blogs, but I wish to say that this write-up very forced me to check out and do it!
    Your writing taste has been amazed me. Thank you, quite nice post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s