C# – FileNotFoundException occured while assign DataSource in CrystalReport

ccrystal-reportsfilenotfoundexceptionvisual-studio-2013

System.IO.FileNotFoundException execption thrown while assigning data source in report.
I am using visual studio 2013, C# 4.5, WinForm application. I have installed crystal report for visual studio 13.

This is code

    DataSet ds = new DataSet();
    ds.Tables.Add(new DataTable("administration_CashDeskManager_Reports_ReportDataBusinessObject"));
    ds.Tables.Add(new DataTable("administration_CashDeskManager_Reports_ReportDataDetailBusinessObject"));

    Reports.CrystalReport.rptCashDeskTransactionLog Report = new Reports.CrystalReport.rptCashDeskTransactionLog();
    Report.SetDataSource(ds);
    crViewer.ReportSource = Report;

Error thrown on Report.SetDataSource(ds) command.

I think this error is version specific error.

Exception detail :

An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in mscorlib.dll

Additional information: Could not load file or assembly
'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET
Framework 4.0\Common\SAP BusinessObjects Enterprise XI
4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.

Best Answer

Try again after adding below section in your config:

<startup uselegacyv2runtimeactivationpolicy="true">
  <supportedruntime version="v4.0" />
</startup>
Related Topic