Crystal Reports Online Training

Learn Online, Anytime, Anywhere

Step-by-step online tutorials.

19.13 Deploying Reports

Deploying Reports

After working hard to build your reporting solution and test it on your computer, you will certainly want to deploy it to the end users computer. Although Microsoft advertises that .NET installations are no more difficult than an “XCOPY” deployment, this is only true if you use 100% .NET managed components. If your application has any non-managed components, you are required to create a deployment package to install it on the client’s computer. This creates setup files that include all the mananaanananged and non-managed components and is responsible for installing them on the client computer.

Prior to Visual Studio 2005, installing Crystal Reports on a client’s computer typically consisted of creating a deployment package and including the appropriate merge modules within the package. The merge modules selected for deployment depended upon which functionality of Crystal Reports you used. Unfortunately, this caused two big problems. The first problem is that people were required to decipher which merge modules were necessary and they could install the wrong ones. Secondly, since the merge modules were optional, you never knew what had been previously installed on a client’s computer and you could assume something was there when it wasn’t. And the fact that this deployment process allowed merge modules to be of different versions compounded the trouble even more. Programmers who have been around a while know all too well what a mess this was.

With the release of Visual Studio 2005, Business Objects decided to get away from merge modules and encourage programmers to use redistributable packages instead. A redistributable package has a .MSI extension. It can be run separately or as part of a bootstrap installation ( a custom action in the setup.exe program runs it for you during the installation process). By giving you only a single redistributable file, this will eliminate the majority of problems caused by the use of merge modules. The other benefit is that it only needs to be installed once per computer.

Consequently, creating a deployment package for a Crystal Reports application is no different than creating one for any other type of application. The only thing you have to do prior to installing it on the client’s computer is to make sure that the Crystal Reports redistributable package is installed beforehand.

One of the most frequent complaints I hear regarding deploying reports is that after deploying a project to a user’s computer is that the reports don’t work anymore. This problem is due to versioning issues when the client computer already has another version of Crystal Reports on their computer. Before deploying a reporting solution to a user’s computer, make sure that both computers have the same versions of Crystal Reports. Additional confusion arises if you have the stand-alone edition of Crystal Reports installed on your computer. Due to the nature of software, both Visual Studio .NET and Crystal Reports have regular service packs available. This makes it confusing to know which version you have on your computer. It’s possible that you installed the most recent Crystal Reports service pack on your development computer, but you haven’t downloaded the most recent redistributable package. Always check the support site to ensure that your software is up to date. There are many downloads to choose from, so read the descriptions carefully to ensure that you click on the right one. The URL for the latest Crystal Reports downloads is:

https://www.sdn.sap.com/irj/sdn/businessobjects-downloads

Required Installation Files

Much to my dismay, I couldn’t find anywhere in the documentation that states where the redistributable packages were copied to during the installation of Visual Studio. The only way to track them down was to use Windows Explorer and search for all the .MSI files on my computer. To save you this trouble, here is where they are located:

Visual Studio 2005
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports\CRRedist2005_x86.msi
Visual Studio 2008
C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5\ CRRedist2008_x86.msi

Deploying a Windows Application

Since Crystal Reports no longer uses merge modules to create deployment projects, creating a deployment package for your reporting application is the same as creating one for any .NET application. Nonetheless, we’ll walk through the steps here so that you see how it works.

To create a deployment project for your application, first open your application in design mode. Then select the menu options File > New > Project. This opens the New Project dialog box.

Open the Other Project Types node and select Setup and Deployment. On the right side, click the Setup Project template. At the bottom of the dialog box, give it an appropriate name and set the file location. You should also select the option Add To Solution so that the setup project stays within the same solution as your reporting application. This is shown in 6.





Figure 19-6. New Windows deployment project.

This adds the setup project to the current application’s Solution Explorer window. Right-click on setup project’s name and select Add > Project Output. This opens the Add Project Output Group window, shown in Figure 19-7.





Figure 19-7. Adding the Primary Output option to the project.

Click the Primary Output option and click the OK button. This adds the application’s executable file to the setup project.

If you are using embedded reports, this is all that is required to create the deployment project. Your report classes are compiled within the application and will be deployed with it. Simply build your project and Visual Studio will create the .EXE and .MSI files you need to deploy this application to a client computer.

If you are using non-embedded reports, the reports are separate from your application and need to be added to the deployment project. This is done one of two ways. If a report is listed in the Solution Explorer window, click on it and look at the Properties window. The first property is Build Action. Click on it and select Content. This tells Visual Studio that the report file is part of the applications content collection.

Next, right-click on the setup project’s name and select Add > Project Output. This opens the Add Project Output Group window again. Select the Content Files option and click the OK button. Since the report was flagged as Content in the Build Action property, it is now included in the deployment project. If you want to confirm this, look for the Content Files node under the setup project’s name and right-click on it. Select the Outputs menu option and you should see the report listed as one of the output files.

If you are using non-embedded reports and they aren’t listed in the Solution Explorer window, you can manually add them to the deployment project. Right-click on the setup project’s name and select Add > File. Browse to where the report is located and select it. This adds it the deployment project’s output.

Once all the report files are added to the project, rebuild the project to create the setup files and use them to install the application on the client computer.