In vs2010 Crystal Report as an independent module exists, in the use of Crystal Reports must be installed before the use of a simple introduction to the focus of packaging Crystal Report because the use of this is too familiar, from 2003 to 2005 and 2008 have been used too much too much.
As follows
After downloading the installation VS2010 can be seen on the left toolbar crystalreportviewer, and can create a new crystal report;
The usage is similar to the previous version, but be aware of the following points;
A The running environment cannot be a. NET Framework 4.0 Clinet profile, to change to the. NET Framework 4, the right key property of the selected item can be changed;
B. Add a app.config to the project (this is for the WinForm project), if the Web project is not added, there is a web.config; In this configuration file, add
<startupuselegacyv2runtimeactivationpolicy= "true" >
<supportedruntimeversion= "v4.0" sku= ". netframework,version=v4.0 "/></startup>
This avoids the ado.net with the Crystal Report runtime due to a. NET version problem
1 SAP Crystal Reports, version for Visual Studio 2010-
Including a crystal report file with a DLL.
2 SAP Crystal Reports, version for Visual Studio 2010-
The files used in the Crystal Report deployment
3 SAP Crystal Reports runtime engine for. NET Framework 4 (32-bit)
Packages that support only 32-bit systems
4 SAP Crystal Reports runtime engine for. NET Framework 4 (64-bit)
Only 64-bit systems are supported
(1) below do a simple crystal report, build a form in the project FORM1, a crystal Report CrystalReport1, a dataset DATASET1; (Crystal Report setup is the same as previous versions)
Put a crystalreportviewer on the form and write it under the FORM1 load event; This is the Crystal Report in the Debug folder under the dynamic loading; You can also put the name of the report on the Crystalreportviewer directly in the project;
private void Form1_Load (object sender, EventArgs e)
{
SqlConnection con =newsqlconnection ("Data source=127.0.0.1;initial Catalog=cldz; User Id=sa; password=888 ");
Con. Open ();
SqlDataAdapter da =newsqldataadapter ("select top * from table", con);
DataSet ds = new DataSet ();
Da. Fill (ds, "ZZZPJ");
String Reportpath = Application.startuppath + @ "/crystalreport1.rpt";
Reportdocument rd = new reportdocument ();
Rd. Load (Reportpath);
Rd. Setdatasource (ds. Tables[0]. DefaultView);
This.crystalReportViewer1.ReportSource = rd;/
}
(2) vs2010 Crystal Report published in two ways;
One, the direct download MSI file installed on the client, the client can be used; 32-bit download above 3); If 64-bit downloads above 4);
Two, is downloading above 2 MSM file, inside the first is CRRUNTIME_13_0.MSM this is the English package, if need to support Chinese to add an MSM, (CRRUNTIME_13_0_ZH_CN.MSM); Plus a crruntime_13_0_maps.msm this can not be used;
With VS2010 packaging software packaging release, a new Installation project, installation project production process here is not detailed, as before the process of making;
After the production, the right key items selected add---merge module-the above mentioned three. MSM end of the file to join in and put
C:/Program Files/common files/merge Modules folder VC100 MSM to join in, if it is 32-bit on the plus X86, if it is 64-bit to add X64;
Then right key item select attribute, click "Prerequisites" button, select the VISUAL C + + 2010 Run-time Library in the pop-up dialog box, note that according to the system selection, there are 32 and 64 bits;
In the following radio button, select the second item "Download prerequisites from the same location as my application";
This release of the preparation is done, select the build on the menu-build project or right key project point to survive;
Note: (the "project" I mentioned above is not the "item" in the menu above the VS toolbar; The project under your solution, for example, you have created a new installation project called SETUP1, which means SETUP1)
If a prepared installer fails to register a module during the installation process, please download a file installation for your system version below
Address http://www.microsoft.com/zh-cn/download/details.aspx?id=14431 specific according to your system version is 64 or 32
The download of this patch also packaged in the following operations
Installing and Deploying visual C-SP1 Runtime Libraries
To run an application developed using Visual C + + 2005 on a computer that does not have Visual C + + 2005 installed, you must first install the Visual C++2005 Runtime library component. Visual C + + SP1 updates this component, so applications developed using Visual c++2005 SP1 must publish the Visual C + + SP1 Run-time Library component with the program. However, when a bug in Visual C + + SP1 is used to deploy with installation and deployment projects, Setup may install the original Visual c++2005 Runtime library component instead of the SP1 version, resulting in the use of visual c++2005 SP1 The development application failed to start. The reason for this problem is%program files%microsoft Visual studio8\sdk\v2.0\bootstrapper\packages\vcredist_ x86 the product code in the product.xml below is not updated during the installation of Visual C + + SP1. To fix the problem, you can open the file and modify the following two lines
<msiproductcheck property= "vcredistinstalled" product= "{a49f249f-0c91-497f-86df-b2585e8e76b7}"/>
And
<bypassif property= "vcredistinstalled" compare= "Valuegreaterthanorequalto" value= "3"/>
For
<msiproductcheck property= "vcredistinstalled" product= "{7299052b-02a4-4627-81f2-1818da5d550d}"/>
And
<bypassif property= "vcredistinstalled" compare= "Valuegreaterthanorequalto" value= "5"/>
The revised Product.xml document is as follows
<?xml version= "1.0" encoding= "Utf-8"?> <product xmlns= "http://schemas.microsoft.com/developer/2004/01/" Bootstrapper "productcode=" Microsoft.visual.c++.10.0.x86 "> <!--defines list of files to is copied on build--
> <PackageFiles> <packagefile name= "Vcredist_x86.exe" homesite= "Vcredistexe"/> <!--patch--> </PackageFiles> <InstallChecks> <msiproductcheck property= "vcredistinstalled" product= "{7299052 b-02a4-4627-81f2-1818da5d550d} "/> <!--<msiproductcheck property=" vcredistinstalled "Product=" { 196BB40D-1578-3D01-B289-BEFC77A11A1E} "/>--> </InstallChecks> <!--defines how to invoke the setup for The Visual C + + 10.0 Redist--> <!--todo:needs Estrimatedtempspace, LogFile, and an update of Estimateddiskspace --> <commands reboot= "Defer" > <command packagefile= "vcredist_x86.exe" arguments= '/q:a ' &G
T <!--these checks determine wheTher the package is installed--> <InstallConditions> <!--<bypassif property= "vcredist Installed "compare=" Valuegreaterthanorequalto "value=" 3 "/>--> <bypassif property=" VCRedistInsta Lled "compare=" Valuegreaterthanorequalto "value=" 5 "/> <!--block Install if user does not have admin privil
Eges--> <failif property= "Adminuser" compare= "Valueequalto" value= "false" string= "adminrequired"/> <!--block Install on Win95--> <failif property= "Version9x" compare= "Versionlessthan" value= "4.10" S tring= "Invalidplatformwin9x"/> <!--block Install on NT 4/less--> <failif property= "Versi Onnt "compare=" Versionlessthan "value=" 5.00 "string=" Invalidplatformwinnt "/> </InstallConditions> & Lt exitcodes> <exitcode value= "0" result= "Success"/> <exitcode value= "3010" result= "Successreboot" "/> <deFaultexitcode result= "Fail" formatmessagefromsystem= "true" string= "Generalfailure"/> </ExitCodes>
;/command> </Commands> </Product>
In addition, Visual C + + version of SP1 can replace%program files%microsoft visual studio8\sdk\v2.0\ with the latest Visual C + + SP1 Run-time Library component Bootstrapper\packages\vcredist_x86 the following vcredist_x86.exe, which will include the latest version of the components in the Setup program that is generated by the installation and deployment of the project.