C# .NET - Crystal reports coding for console applicaiton on C#.net

Asked By nandu on 16-Jul-10 01:02 PM
Is It possible to write code in c#.net Console application for generating Crystal reports??????
Anoop S replied to nandu on 16-Jul-10 04:22 PM
Yes its possible, here a simple Console application example,Putting this into actual use would require error checking/exception handling

using System.IO;
using System.Net.Mail;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
 
namespace ConsoleApplication1
{
  class Program
  {
    static void Main(string[] args)
    {
      ReportDocument report = new ReportDocument();
 
      report.Load("CrystalReport1.rpt");
 
      report.ExportToDisk(ExportFormatType.PortableDocFormat, "Report.pdf");
 
      SmtpClient smtp = new SmtpClient("mail.domain.com");
      MailMessage message = new MailMessage("reportgenerator@domain.com", "recipient@domain.com");
 
      message.Attachments.Add(new Attachment("Report.pdf"));
 
      smtp.Send(message);
 
      File.Delete("report.pdf");
    }
  }
}
Perry replied to Anoop S on 04-Nov-10 01:25 PM
What references need to be added to have the namespace CrystalDecisions.CrystalReports.Engine and CrystalDecisions.Shared able to be used in the application code?  I've been searching high and low for the answer to that for days now.  I know how to do everything else.  I am a long time Crystal Reports developer, but I need to know how to get it accessible to be included in a console.
Cody replied to nandu on 14-Jul-11 11:21 AM
Did you ever discover what references you need? I am having the same issue.