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:
- 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
- Create a new Setup project and name it RedistCrystalReports2005_x86
- Right-click the project name in the solution explorer and select Add -> Merge Module...
- Select the merge module CrystalReports2005_x86.msm file from the dialog box
- 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.