Click here to Skip to main content
11,930,788 members (58,543 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# setup CrystalReports
I have an exe of my c# project.I am using crystal reports for reporting And included Crystal report runtime as one of my prerequisites. i've installed crystal report runtime for VS2008.But
When I wants to view my reports in another computer, shows error.
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified.
   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options) at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

My code includes this line:
cryrpt.Load("D:\\C# projects\\project\\project1\\CrystalReport7.rpt");
I have 1 doubt, ie my exe is in different computer's different location.If im opening CrystalReport7.rpt from that location can I able to view it? If no,how to change the path ?
Posted 28-Dec-11 21:54pm
Edited 2-Jan-12 20:36pm
panditramesh 10-Jun-12 7:22am
how can i solve this probulem when i run crystel report then error this namespace "CrystalDecisions".
lilian87 13-Jun-12 10:48am
use the namespace-
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

U can have the current execution directory form this
string directory = AppDomain.CurrentDomain.BaseDirectory;
then u have to modify Load path accordingly to access ur .rpt files also after publishing the project u also had got the compiled .rpt file, use them also along with ur exe.
lilian87 29-Dec-11 3:38am
Sorry to ask you..
After setup , when i executed
string directory = AppDomain.CurrentDomain.BaseDirectory;
Project exists in bin\release folder.
How to change the path of crystal report accordingly?
amit28august 29-Dec-11 3:53am
u use string handling functions String.Replace("bin\\release\\","REPORT FOLDER NAME HERE");

take it from ur folder
lilian87 29-Dec-11 9:05am
i want to change the path of crystal reports used in my form.I'm using 7 crystal reports in this project.So how will I change the path of all crystal reports so that i can access it from another computer??
RaisKazi 29-Dec-11 3:43am
Edited: Formatted using "pre" tag.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Check this Tip/Trick

Crystal Reports: Fix for "Load report failed" error.[^]


I want to set a dynamic path in crystal report viewer?[^]


Check Application Class[^] which contains many paths
Here you need Application.ExecutablePath[^] or Application.StartupPath[^] Property

Simple Tip is while debugging you can check the path from your code & do changes based on your requirement, not a big deal. Finish it.

Happy new year wishes! Rose | [Rose]
lilian87 29-Dec-11 3:40am
Thanx for reply. But this is not what I want.After setup,in another computer my reports are not running,Its showing error-load report failed.
thatraja 29-Dec-11 9:55am
Did you read that Tip/Trick fully? There are couple of scenarios.
lilian87 29-Dec-11 10:16am
ya, iwent through it. I dont have any problem running reports in my computer.When i install project exe in another computer there i cannot open it. It gives the error-load report failed.. Any solution?
thatraja 29-Dec-11 10:25am
Check the case Invalid File path or File name in that Tip/Trick
Use relative paths(Application's Startup Path or Executable path) instead of hard-code paths. Put your reports files in your application folder.
lilian87 29-Dec-11 11:06am
I also have the same doubt.Maybe invalid file path. when we click crystalreport.rpt on our solution we get the file path.I used that path in my code.But it specifies to the D: drive of my computer.If I'm running this app on any other computer will it identify this location? instead of using this path how can i change the path specifying 'my computername and the full report path'?
thatraja 29-Dec-11 11:09am
That's why I said to use Relative path instead of hard code path. Check my updated answer again.
lilian87 29-Dec-11 11:18am
Can you help me in the same with any example?? or part of code to "show a report on button click"?
thatraja 29-Dec-11 13:14pm
Did you check the 2nd link in my answer? That's it.
lilian87 31-Dec-11 2:49am
Sorry for the late reply. I checked the link. But the problem is that when im using relative paths again the error comes because the path is wrong.I've copied the crystal reports to the release folder.but still the error comes.What should i do?
thatraja 31-Dec-11 3:46am
You copied files ob, but did you set the right path? check the 2nd link in answer
lilian87 31-Dec-11 8:47am
I think now u will kick me out..
Bcoz if im using relative paths its showing load report failed.
report.Load(Application.StartupPath + "CrystalReport7.rpt");
The path is bin\release.If im using hard code it will work.But in both cases its not working in another computer.
thatraja 31-Dec-11 9:02am
Check my updated answer
thatraja 30-Dec-11 9:36am
Did you solve it?
lilian87 1-Jan-12 3:45am
Thanks for the reply!! and new year wishes to you too...
I used the code-
Now its working.. Really thanks for your patience and kind.
gsspartners 11-Jan-12 3:43am
i am having the same kind of problem, after the setup when i run the application on other system i am getting a Crystal Report Login Error. I tried various things but was unsuccessful, i tried using TableLogonInfo, dataset, gave the path of the Crystal report, stuff like these available on GOOGLE but of no use. Please help me fix these. If someone can help me with simple Crystal Report Printing on Button click just for an idea, i will really apperciate.Help me with this error, thanks in anticipation.

Lilian -> Plz help me with his as u were having the same issue.

thatraja 11-Jan-12 6:02am
Did you check the 1st link in my answer? What's the complete error message? mention it
gsspartners 18-Jan-12 6:49am
thatraja i have tried using report.load(Application.StartupPath+"\\CrystalReport4.rpt"); Error
so i tried (System.AppDomain.CurrentDomain.BaseDirectory +"\\CrystalReport4.rpt")
but it it also giving me Error i have tried many things i hav got CONFUSED
i would really appericiate if u can give me the complete code...on page load
or give me a simple code link which can help me.
Error: that i am getting is Load fail or(sometimes) crystal report Login popup
thanks in anticipation
lilian87 18-Jan-12 8:26am
You can run the report in your pc, not in other pc.. Isnt that your problem?The error i got was 'Load Report Failed'.Is this the same error you are getting?

If so, then 1.Add Crystal Report Runtime as prerequisite.

2.Change the path of crystal report load to


3.Include the report files in the project folder.These may help you.. Try it!!
lilian87 12-Jan-12 8:34am
Check the links in this solution.. It was helpful for me.. what is the error message?
gsspartners 18-Jan-12 2:42am
Hi,sorry 4 being late on my pc(development pc)when i run the setup the report is not loading though crystal reportviewer is opening. On other systems the same application after setup is giving crystal report Login error, plz help me through
thatraja 18-Jan-12 3:08am
You don't have to hard code. Keep your report files in your project folder. And use relative path. That's all. Try it.
swapnilKu 18-Jan-12 2:55am
But before deploying an application,if project needed to be moved to another PC.
How to set path.
do i have to hard coded it.
thatraja 18-Jan-12 3:00am
You don't have to hard code. Keep your report files in your project folder. And use relative path. That's all. Try it.

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

Advertise | Privacy | Mobile
Web02 | 2.8.151126.1 | Last Updated 3 Jan 2012
Copyright © CodeProject, 1999-2015
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