Jan Schreuder on .Net

.Net code samples, experiences, observations

View my professional profile on LinkedIn

Recent Posts

Tags

News

  • Inappropriate comments will be deleted at my discretion.

    The information and code samples in this weblog is provided "AS IS" without warranty of any kind, either expressed or implied, including but not limited to the merchantability and/or fitness for a particular purpose.

Community

Email Notifications

Tool suppliers

Tools

General

Microsoft

Favorite blogs

Archives

Deploying applications that use Crystal Reports for .Net

I know, for a lot of Microsoft developers Crystal Reports (CR) is a no-go area. But I know that a lot of developers are using it, whether they like it or not. Because of my posts about CR, and more specifically my CrystalHelper class, I'm asked how to deploy applications that use the free version of CR that is shipped with various versions of Visual Studio.

This information is already available at support site for CR. In this post I will post links to that documentation as a reminder to myself, but also to help others that need help when deploying CR to client or server machines.

Register your version of CR

Although you are allowed to freely distribute the CR engine that is supplied with Microsoft Visual Studio, you still need to register that version. To do so, simply add a report to your application. CR will check if registration has already taken place. When this is not the case, CR will ask if you wish to register. Just follow the steps and registration will take place. Registration is free!

Register yourself as a CR developer at Business Objects

An important source of information for everyone using CR, as a developer or a report designer, is the Diamond Technical Community web site. When you register here, you get access to all the documentation available on CR. Most of the information I will link to in this post can be found here, the downloads for Merge Modules and Service packs.

CR as part of a VS 2002/2003/2005 project

For Visual Studio 2002/2003/2005, you are required to use merge modules. The current version of these modules can be found here:

These downloads contain a number of merge modules. Which module is required for your setup depends on the reports you are deploying. A very comprehensive document that explains which modules to add and how to do so when you use Visual Studio 2002/2003 can be found here. Documentation on how to use the merge modules in Visual Studio 2005 is enclosed in the download of those merge modules.

CR as part of a VS 2008 project

The version of CR distributed with Visual Studio 2008 is actually the same as the one distributed with Visual Studio 2005. So for that version, simply follow the instructions for that version.

Building a redistributable package for VS 2005

For applications built with Visual Studio 2005, it might also be a good idea to have a Runtime Package as a custom action or a pre-requisite in your setup. There are some reasons for this:

  • In a network environment, these packages can be pushed by the network administrator
  • The embedded merge modules force you to rebuild the setup for your applications if you want to take advantage of fixes or service packs
  • The runtime package is not part of your setup and can be deployed once, rather than each time your application is installed.
  • Since the setup it is significantly smaller when the merge modules are omitted, the download of your setup takes less time.
  • Setup of your application is faster as it doesn't have to install the merge modules.

CR however does not provide redistributable packages for this version (or for Visual Studio 2002/2003) so I created one myself for use in my current project. For those interested, I followed this easy steps:

  1. Once you have downloaded the merge modules for Visual Studio 2005, extract the file CrystalReports2005_x86 to the folder C:\Program Files\Common Files\Merge Modules
  2. Create a new Setup project and name it RedistCrystalReports2005_x86
  3. Right-click the project name in the solution explorer and select Add -> Merge Module...
  4. Select the merge module CrystalReports2005_x86.msm file from the dialog box
  5. Build the project

And you're ready. A redistributable for CR reports to support the applications you build using Visual Studio 2005 and Visual Studio 2008.

I'm sure this can also be done for Visual Studio 2002/2003 but I have not been able to test that. But the steps would be similar, with the exception of license information which is required for these versions of Visual Studio.

Comments

David said:

Destroying applications? Interesting..

# May 14, 2008 11:26 PM

deploying a project in visual studio 2003 said:

Pingback from  deploying a project in visual studio 2003

# May 30, 2008 10:35 PM

Joe said:

I am deploying a VS 2008 C# application, using Crystal Reports 9. Do I still use the VS 2008 merge modules, or should I use something else???

Is it worth it to convert to CR Basic for VS 2008???

# June 3, 2008 6:22 PM

veljkoz said:

If you are using Crystal Reports for Visual Studio 2008, in order for your application to work when you deploy it, the most simple way to do it is to install on client computer the "Crystal Reports Basic for Visual Studio .NET 2008" msi package - see support.businessobjects.com/.../runtime.asp

After it installs, applications can use CR... very painless, and no need to use the merge modules

# June 17, 2008 11:42 PM

Jan Schreuder said:

That is correct.

# June 18, 2008 8:59 AM

Arun Sabat said:

Download merge modules for VS2005 link is not working.

The businessobject site redirects mr to

www.businessobjects.com/.../default.asp

Can you please give me the latest link to download merge module for VS2005

# July 31, 2008 9:09 AM

Jan Schreuder said:

The people from SAP have changed the entire website, so the links don't work anymore. Please check this link for updates: bloggingabout.net/.../need-help-with-crystal-reports-look-here.aspx

# July 31, 2008 11:55 AM

Nancy Forbes said:

I was able to deploy a report in a .NET 2003 project.  There were some issues with the graphic images and since we are upgrading to VS 2008 in a month I went ahead and downloaded VS 2008 eval early.  I ran the redistributable msi on my development web server but I'm getting 'OBJECT REFERENCE NOT SET TO AN INSTANCE OF AN OBJECT' error on the report.  In my 2003 project I had to create a virtual directory that pointed to the Crystal dll's. to resolve this.  I've tried that on my 2008 project but no joy.  I've problaby have named the virtual wrong as I can't find any documentation for 2008.  I found the 2003 documentation here:  boc.sdn.sap.com/.../235   Ideas?

# August 6, 2008 11:16 PM

Jan Schreuder said:

I have no idea. My best guess is to post this question either in the sap Crystal Reports forum (for links see here: bloggingabout.net/.../sap-is-annoying-me.aspx) or in the Microsoft Crystal Forum: forums.msdn.microsoft.com/.../threads

# August 7, 2008 8:34 AM

Nancy Forbes said:

This is how you deploy Crystal to a Web Site with Visual Studio 2008.

1.Install the CRRedist2008_x86.msi on the web server

2.You will also need to copy a directory and its contents from your computer to the root web of any web site that you create Crystal Reports in.  On my computer this directory was located at:  C:\Inetpub\wwwroot\aspnet_client\system_web\2_0_50727\CrystalReportWebFormViewer4  You will need to copy it in the aspnet_client\system_web\2_0_50727 folder of the root web you are installing the Crystal Report application.  See forums.asp.net/.../992330.aspx for additional information - this fixes problems with the Crystal Toolbar.

3. When you create a report within your asp.net application, it will not publish by default.  You need to change the properties on the report.  I haven't experimented a lot with these but changing the Build Action to "Content" and the Copy to Output Directory to either "Copy on Newer" or "Copy always" worked for me.  

4.  I also experienced fewer problems if when I published, I chose to Delete existing files.

The following VB code sample is provided for anyone else who is struggling with passing parameters via a querystring.  This is much simpler than most of the examples that I found on the net.

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine

Partial Public Class myASPNETPAGE

   Inherits System.Web.UI.Page

   Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init

       Dim myReport As New TheReportName

       myReport.Load(Server.MapPath("TheReportName.rpt"))

       myReport.SetParameterValue("@Par1", CInt(Request.QueryString("P1")))

       myReport.SetParameterValue("@Par2", Request.QueryString("P2"))

       'Connection Info

       Dim myConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo

       Dim myTableLogOnInfo As New CrystalDecisions.Shared.TableLogOnInfo

       Dim myDatabase = myReport.Database

       Dim myTables = myDatabase.Tables

       Dim myTable As CrystalDecisions.CrystalReports.Engine.Table

       myConnectionInfo.ServerName = "DatabaseServer"

       myConnectionInfo.DatabaseName = "Database"

       myConnectionInfo.UserID = "UserAccount"

       myConnectionInfo.Password = "Password"

       For Each myTable In myTables

           myTableLogOnInfo = myTable.LogOnInfo

           myTableLogOnInfo.ConnectionInfo = myConnectionInfo

           myTable.ApplyLogOnInfo(myTableLogOnInfo)

       Next

       CrystalReportViewer1.ReportSource = myReport

   End Sub

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

   End Sub

   Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As EventArgs) Handles CrystalReportViewer1.Init

   End Sub

End Class    

# August 15, 2008 12:08 AM

Henry said:

i was able to deploy CR in VS .Net 2003, but also have

got another problem. the export, print, and other CR View toolbar doesn't appear corectly. the condition was:in my form i'm using tab control that have view tabpage and there's a CR view for each tab page...it doesn't happen before i deploy it...why is it possible...ideas???????????

# August 27, 2008 5:59 AM

Jan Schreuder said:

Is it an ASP.Net of WinForms application

# August 27, 2008 9:18 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)