Willydev Deployment Crystal2005
Willydev Deployment Crystal2005
2004 Business Objects. All rights reserved. Business Objects, the Business Objects logo, Crystal Reports, and Crystal Enterprise are trademarks or registered trademarks of Business Objects SA or its affiliated companies in the United States and other countries. All other names mentioned herein may be trademarks of their respective owners. Version 1.0
Requirements
To successfully deploy a Web Site or Windows application, you must complete Appendix: What Needs to be Installed? and Appendix: Project Setup. Check that the following requirements are met: Visual Studio 2005 is installed. See Appendix: What Needs to be Installed?. Web Sites or Windows applications have been created with one or more report binding scenarios. Please refer to the online help in Visual Studio 2005.
In addition, you must either use merge modules or the Server Installer (.msi file) to complete the deployment. One of the following procedures must be completed: Download the Crystal Reports merge modules from http://www.businessobjects.com/products/dev_zone/net/VisualStudio2005Beta, and then save the .msm files in C:\Program Files\Common Files\Merge Modules folder of your local directory. You need to overwrite the files that already exist in this folder. For more information, see Appendix: Crystal Reports Merge Modules for Visual Studio 2005. Or, download the Server Installer (.msi file) from http://www.businessobjects.com/products/dev_zone/net/VisualStudio2005Beta, and then install the files on the target machine. The Server Installer installs the Crystal Reports runtime and the merge modules that are required by a deployment project. The Server Installer is available for x86, AMD64 and IA64 machines.
2. Navigate to the directory where your deployment project has been saved. 3. Double-click the WebSetup1 folder. 4. Open the Debug folder to find the built files from the Web Setup Project. 5. Copy all the files to the target computer. 6. Distribute the Crystal reports that are used in the Web application. For more information about which binding scenarios need to distribute report files, see Appendix: Report Files. 7. On the target computer, double-click Setup.exe or WebSetup1.msi to install the Web application. 8. To view the Web application in deployment, start Microsoft Internet Explorer, and type http://localhost/WebSetup1.
.msm IA64 Web Sites Crystal_Database_Access_I64.msm Crystal_Database_Access_I64_enu.msm Crystal_Managed_I64.msm Crystal_Webformviewer.msm _VC_80_WinSxS_ATL_IA_RTL_X86_--.msm _VC_80_WinSxS_MFC_IA_RTL_X86_--.msm
The merge modules can be downloaded from http://www.businessobjects.com/products/dev_zone/net/VisualStudio2005Beta. Note For more information about merge modules in Crystal Reports for Visual Studio .NET 2002 or 2003, and Crystal Reports 10, please refer to the online help in Visual Studio 2005.
Binding to an Embedded Report Class Binding to an Embedded Report Class Upcast to ReportDocument Binding to a Cached Embedded Report Class Binding to Crystal Enterprise (Crystal Reports 10) Binding to Report Application Server (Crystal Reports 10) Binding to Unmanaged RAS Using ReportDocument.Load() Method (RAS 10) Binding to Unmanaged RAS Using ReportDocument.FileName Property (RAS 10) Binding to Unmanaged RAS Using ReportClientDocument.Open() Method
No need to distribute report files; report files are accessed through the unmanaged RAS server. The unmanaged RAS server that is used in the binding scenarios needs to be running on the network. Report binding scenario in Binding to Unmanaged RAS Using ReportClientDocument.Open() Method (RAS 9 and up) needs Report
Copyright 2004 Business Objects Page 9
(RAS 9 and up) Binding to ReportSource (Crystal Enterprise 10) Binding to Managed RAS Using ReportDocument.Load() Method (RAS within CE 10) Binding to Managed RAS Using ReportDocument.FileName Property (RAS within CE 10) Binding to Managed RAS Using ReportAppFactory.OpenDocument() Method (RAS within CE 9 and up)Binding to InfoObject Cast as Report
Application Server to be installed on the target computer. No need to distribute report files; report files are accessed through the managed RAS server. The managed RAS server that is used in the report binding scenarios needs to be running on the network. Report binding scenario in Binding to ReportSource (Crystal Enterprise 10) needs Crystal Enterprise .NET SDK and Crystal Enterprise Publishing Wizard to be installed on the target computer.
Note For more information about each binding scenario, please refer to the online help in Visual Studio 2005.
Therefore a common set of instructions can be given for setting up your project, with only minor variations for the Web or Windows versions of the project. The procedures in this section must be completed in succession: Creating a New Web or Windows Project Applying Standard Project Settings Preparing the Web or Windows Form Adding a CrystalReportViewer Control
Creating a New Web or Windows Project in Visual Studio .NET 2002 or 2003
Before you create a Web or Windows project, verify that Crystal Reports for Visual Studio .NET 2002 or 2003 has been installed on your system. See Appendix: What Needs to be Installed?. Note Use a Pascal naming convention: set the first letter of the project name to uppercase (because the project name also becomes the namespace name for the assembly generated from the project).
4. From the Templates list, click ASP.NET Web Application. 5. In the Location field, replace the default project name with the name of your project. The sample below assumes that your server name is http://localhost.
[Visual Basic]
http://localhost/MyProjectNameVBNET
[C#]
4. In the same folder, select Designer Defaults. On the Page Layout list, set the value as follows: In a Windows project, set the value to Grid. In a Web project, set the value to Flow.
To modify project settings for a C# in Crystal Reports for Visual Studio .NET 2002 or 2003 1. In your C# project, right-click the project name (the name in bold that is just below the solution name in Solution Explorer) and click Properties. 2. In the Property Pages dialog box, expand the Common Properties folder, and click Designer Defaults. On the Page Layout list, set the value as follows: In a Windows project, set the value to Grid. In a Web project, set the value to Flow.
Preparing the Web or Windows Form in Visual Studio .NET 2002 or 2003
In this section, you prepare the Web or Windows Form in Visual Studio .NET 2002 or 2003.
End Sub
[end] [C#]
Next, you put a call to the ConfigureCrystalReports() method from within an event method, so that the ConfigureCrystalReports() method runs automatically when the form loads. The ConfigureCrystalReports() method enables users to interact with the report at runtime. It also controls programmatic interaction with the report. Note The Page_Load event method is typically used to enter Web Form configuration code in a .NET Web application. However, Page_Load is not the recommended event method to use with Crystal Reports. For more information, please refer to the online help in Visual Studio 2005. 2. Click the + symbol on the Web Form Designer generated code region to expand and display its contents. It is usually best to keep this region collapsed, because it contains auto-generated content that you rarely modify. However, you must add one line of code to this region before you collapse it again. 3. Within the "Page_Init" [Visual Basic] or "OnInit" [C#] event method, and below the method call to InitializeComponent(), enter a call to the ConfigureCrystalReports() method.
[Visual Basic]
ConfigureCrystalReports()
[end] [C#]
ConfigureCrystalReports();
[end]
4. Click the - symbol on the Web Form Designer generated code region to collapse the contents of this region. 5. In Solution Explorer, right-click Default.aspx, and then click Set As Start Page. This page is now the first page to load when the website is accessed. 6. From the File menu, click Save All.
1. If Form1 is not already displayed in the main window, double-click Form1 in Solution Explorer to open it in Design view. 2. From the View menu, click Code. The code view of the Form1 class appears. The display of this class is dependent on whether your Windows application is coded in Visual Basic or C#. In C#, the Form1 class displays the following: A class-level variable declaration (the components variable). A constructor (Form1). A Dispose() method. A Main() method. A Windows Form Designer generated code region.
In Visual Basic, the Form1 class displays only a class signature and the Windows Form Designer generated code region. Next, you add a private helper method that is used as the designated location for all code that configures Crystal Reports for the class. To add a private helper method for Crystal Reports configuration code 1. Add to this Form1 class a new private scope helper method with no return value, named ConfigureCrystalReports().
[Visual Basic]
Next, you put a call to the ConfigureCrystalReports() method from within the class constructor, so that the ConfigureCrystalReports() method runs automatically when the form loads. Note The class constructor for Visual Basic, New(), is contained within the Windows Form Designer generated code region. You need to expand this region temporarily in Visual Basic to have access to the class constructor. After you have finished your modification, it is recommended that you collapse this region and place your code within the ConfigureCrystalReports() method. 2. Within the class constructor New() [Visual Basic] or Form1() [C#] and below the method call to InitializeComponent(), enter a call to the ConfigureCrystalReports() method.
[Visual Basic]
ConfigureCrystalReports()
[end] Copyright 2004 Business Objects Page 15
ConfigureCrystalReports();
[end]
Note If you use Visual Basic, you can now collapse the Windows Form Designer generated code region. 3. From the File menu, click Save All.
6. For either Visual Basic or C#, if you are working in a Windows project, from the Properties window set the Dock to Fill (either by selecting the middle square of the Dock selection graphic, or by typing "Fill" into the field). Note This causes the CrystalReportViewer to fill the entire Windows Form. 7. From the File menu, click Save All. 8. From the View menu, click Code. The code-behind class for the Web or Windows Form appears. Next, you declare a namespace, to provide access to the SDK. 9. Above the class signature, add an "Imports" [Visual Basic] or "using" [C#] declaration to the top of the class for the CrystalDecisions.Shared and CrystalDecisions.CrystalReports.Engine namespaces.
[Visual Basic]
Note To access various classes for Crystal Reports without a namespace prefix, you must declare those namespaces at the top of the class. You have now completed the procedures to create a Web or Windows project in Visual Studio .NET 2002 or 2003.
3. In the New Web Site dialog box, select a language folder for C# or Visual Basic from the Project Types list. 4. From the Templates list, click ASP.NET Web Site. 5. In the Location field, replace the default project name, C:\WebSites\WebApplication1, with the name of your project. C:\WebSites\MyProjectName 6. Click OK.
End Sub
[end] [C#]
The ConfigureCrystalReports() method enables users to interact with the report at runtime. It also controls programmatic interaction with the report. Next, you create the Page_Init event method to call the ConfigureCrystalReports() method. This event method guarantees that the ConfigureCrystalReports() method runs when the form loads. Note The Page_Load event method is typically used to enter Web Form configuration code in an ASP.NET Web application. However, Page_Load is not the correct event method to use with Crystal Reports. For more information, please refer to the online help in Visual Studio 2005. 2. At the top left drop-down list of the Code view, select Page [C#] or Page Events [Visual Basic]. Note This causes the top right drop-down list to be populated with all available events for this control. 3. From the top right drop-down list, choose the Init event. The following method signature is created in your code-beside class:
[Visual Basic]
Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init End Sub
[end] [C#]
4. Within the Page_Init event method, enter a call to the ConfigureCrystalReports() helper method.
[Visual Basic]
ConfigureCrystalReports()
[end] Copyright 2004 Business Objects Page 19
ConfigureCrystalReports();
[end]
In Visual Studio 2005, the .aspx page, and its corresponding code-beside class compile together into a single class to share members. This is possible because a new feature of Visual Studio 2005, called partial classes. For example, when you add a CrystalReportViewer control to the Default.aspx page, at compile time, the page becomes the Default_aspx partial class. The controls on the .aspx page are converted to class-level variable declarations. Because the code-beside class is also a partial Default_aspx class, the .aspx page can access the properties and methods of the CrystalReportViewer variable as a member of its own class. Also, controls on the .aspx page can access methods in the code-beside class. For example, a Button control can reference a click event method that is available in the code-beside class from its OnClick property. To add Imports/Using statements to reference namespaces 1. In Solution Explorer, open the Web.config. 2. In the <assemblies> node, verify that the following Crystal Reports assemblies have been added: CrystalDecisions.CrystalReports.Engine CrystalDecisions.Shared Note The references are automatically added to the Web.config file when you drag and drop the CrystalReportViewer control onto the page. If for some reason the references have not been added, you must open the Add Reference dialog box and manually add the two assemblies listed above. 3. Click OK. 4. Select the Default.aspx page. 5. From the View menu, click Code. The code-beside class for the Web Form appears. 6. Above the class signature, add an "Imports" [Visual Basic] or "using" [C#] declaration for the namespaces of the assemblies that are listed above.
[Visual Basic]
Note The classes of these two assemblies are commonly used in all tutorials. For any additional assemblies that you may occasionally require in specific tutorials, you will be directed to add them during that tutorial. You have now completed the procedures to create a Web Site in Visual Studio 2005.
Next you create an event method, and then put a call to ConfigureCrystalReports() within that new event method. This will cause the ConfigureCrystalReports() method to run automatically when the form loads. 2. From the View menu, click Designer. 3. Double-click on Form1. You are returned to Code view. Because you double-clicked on Form1, a Form1_Load event method is automatically generated in the Form1 class.
Copyright 2004 Business Objects Page 23
4. Within the Form1_Load event method, enter a call to the ConfigureCrystalReports() method.
[Visual Basic]
ConfigureCrystalReports()
[end] [C#]
ConfigureCrystalReports();
[end]
7. From the File menu, click Save All. 8. From the Build menu, click Build Solution. 9. From the View menu, click Other Windows, and then click Object Browser. 10. In the Object Browser, expand the [project name] node, then the [project name] namespace node, and then click on the Form1 class. The members of the Form1 class are displayed, which include both the CrystalReportViewer variable (from the Form1.Designer.cs partial class) and the ConfigureCrystalReports() method (from the Form1.cs partial class). In Visual Studio 2005, Form1 and its corresponding Form1 Designer class compile together into a single class that shares their members. This is possible because a new feature of Visual Studio 2005, called partial classes.
Copyright 2004 Business Objects Page 24
For example, when you add a CrystalReportViewer control to Form1, Visual Studio 2005 regards that addition as a class-level variable declaration in the Form1.designer.cs (or .vb) partial class. Because the code-beside class is also a partial Form1 class, Form1 can access the properties and methods of the CrystalReportViewer control. Also, controls in one Form1 partial class can access methods in the other. For example, a Button control in the Form1 Designer class can reference a click event method that is available in the Form1 code-beside class from its OnClick property. To add Imports/Using Statements to reference namespaces 1. If the References folder is not visible in Solution Explorer, on the Solution Explorer toolbar, click Show All Files to display all project files. 2. In Solution Explorer, expand the References folder. 3. Verify that the following Crystal Reports assemblies have been added: CrystalDecisions.CrystalReports.Engine CrystalDecisions.Shared
4. Select Form1, and then from the View menu, click Code. The Code view of the Form1 class appears. 5. Above the class signature, add an "Imports" [Visual Basic] or "using" [C#] declaration to the top of the class containing the following Crystal Reports namespaces.
[Visual Basic]
Note To access various classes for Crystal Reports without a namespace prefix, you must declare those namespaces at the top of the class. You have now completed the procedures to create a Windows project in Visual Studio 2005.
4. Note the Version column shown in the window. This is the "Assembly version." 5. Locate the highest number for a particular assembly. 6. Right-click the file, select Properties, and then click the Versions tab within the Properties window. 7. Compare the file version against the version number in the chart below. Note If you are using Crystal Reports version 9.0 with Microsoft Visual Studio .NET 2003, the maintenance release for CR 9.2 (available as the CR 9.2 upgrade CD) must be installed. Crystal Decisions supports only CR 9.2 in Visual Studio .NET 2003. If Borland C# is installed after Visual Studio .NET 2003, it updates the assembly versions. Product Crystal Reports for Visual Studio .NET 2002 Crystal Reports for Visual Studio .NET 2002 (patched) Crystal Reports 9 Crystal Reports 9 (patched) Crystal Reports for Visual Studio .NET 2003 Crystal Reports for Visual Studio .NET 2003 (patched) Crystal Reports 10 Crystal Reports for Visual Studio 2005 Crystal Reports for Borland C# Hot Fix Applied? no yes Optional Add-Ons none none Assembly Version 9.1.3300 9.1.3300 File Version 9.1.9360 9.1.9466
no yes no yes
no no no
10.0.9500.x
9.1.9800.x