Click here to Skip to main content
12,952,273 members (43,635 online)
Rate this:
Please Sign up or sign in to vote.
Hi people, I create a wpf project in VS2010 with .Net Framework 4.0 and I use crystal report for reporting. In debug and run it perfectly works, but when I install program by using setup file, then It gives an error like "program has stopped working". I installed cr runtime engine. CR version is 13.0.4. If report were not shown, then program works correctly. Only problem is in showing report. I trying to add Crystal Report references as dll into setup, which does not work. Runtime Engine is installed. Merge Modules are added into Setup Project. I can not find another solution.
Thanks in advance for help.
Posted 19-Nov-12 2:20am
Updated 19-Nov-12 21:47pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I have the same configuration VS2010 + net framework 4.0 and i use crystal report but it work fine, no problem when i deploy.
i think the problem is that when you install your setup your application doesn't find the report path. be sure the install put the report in the right place that your application try to load it.
MahmutKoyuncu 19-Nov-12 9:00am
Thanks for your response. It is not directly load from file path. I create report as an object. Can it be same problem again?
MahmutKoyuncu 19-Nov-12 10:16am
I try to load from file path. Again same thing happened. I write file path to text file and it is correct. In the directory, the report exists, but again I face to face an error. I cannot find it :S
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try this it work fine with me
the report must be in one Directory of the Executing Assembly Directory

string ReportPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\ReportFolder\ReportName.rpt";

CrystalDecisions.Shared.ConnectionInfo crConnectionInfo = new CrystalDecisions.Shared.ConnectionInfo();
crConnectionInfo.DatabaseName = DatabaseName;
crConnectionInfo.Password = Password;
crConnectionInfo.UserID = UserID;
crConnectionInfo.ServerName = ServerName;
rptDocument.SetDatabaseLogon(UserID, Password, ServerName, DatabaseName, False);
rptDocument.PrintOptions.PrinterName = PrinterName;
rptDocument.PrintToPrinter( 1, false, 0, 0);
catch (Exception ex)
Nelek 19-Nov-12 13:35pm
Please don't post solutions to add information, to ask something or to comment another user.
- To add information to your message, you can use the widget "Improve question" / "Improve solution" at the bottom of your text.
- To ask/answer a user, you can use the widget "Have a question or comment?" (as I am doing right now with you) or the widget "reply" in another comment.
Jean-Claude ADIBA 19-Nov-12 13:46pm
;) thank you for your precision
Nelek 19-Nov-12 17:13pm
You are welcome
MahmutKoyuncu 19-Nov-12 17:52pm
yes AppDomain.CurrentDomain.BaseDirectory + @"ReportFolder\ReportName.rpt"; works too but path correct I check and report is in the directory. And the code is in try-catch block.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,239
CHill60 3,490
Maciej Los 3,083
Jochen Arndt 1,975
ppolymorphe 1,880

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 20 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100