Click here to Skip to main content
15,879,239 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Updated 19-Nov-12 21:47pm
v2

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.
 
Share this answer
 
Comments
Mahmut Koyuncu 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?
Mahmut Koyuncu 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
Try this it work fine with me
the report must be in one Directory of the Executing Assembly Directory

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


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)
{
MessageBox.Show(ex.Message);
}
 
Share this answer
 
Comments
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
Mahmut Koyuncu 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900