1
votes

I have embedded some crystal reports in my C# application. The problem is, compiling the project creates dlls for the reports also, which means in future any change in report will need re-installation of the application. Is there any way that I can keep them as .rpt files and they can be changed any time by just copying the .rpt file into application folder??

Thanks :)

2

2 Answers

3
votes

You can use ReportDocument.Load method.

ReportDocument reportDocument = new ReportDocument();
reportDocument.Load(reportName, OpenReportMethod.OpenReportByTempCopy);
crystalReportViewer.ReportSource = reportDocument;
0
votes

Yes, in one of my applications I set the "Copy To Output Directory" property of the report to "Copy Always" and the "Build Action" as "Content" so that the report is copied down as content when it is deployed.

Then when you load the report you can set the connection information and parameters at runtime.

I currently do this for a ClickOnce application for a client.