none
The report definition for report 'ABC.rdlc' has not been specified RRS feed

  • Question

  • Hi all,

    I've recently moved my RDLC files into the class library (as I'm going to be having multiple "UI" projects accessing the same reports). So as I moved them to the class library and set them as Embedded Resources I changed the binding of the report viewer to:

    Microsoft.Reporting.WebForms.ReportDataSource rdsAPI = new Microsoft.Reporting.WebForms.ReportDataSource("DS1", ds1 as System.Data.DataTable);
    Microsoft.Reporting.WebForms.ReportDataSource rdsUser = new Microsoft.Reporting.WebForms.ReportDataSource("UserDS", user as System.Data.DataTable);
    
    ReportHelper.SetReportEmbeddedResource(rvds1Pdf, "ClassLibrary1.Namespace.Blah.ds1.rdlc");
    rvds1Pdf.LocalReport.DataSources.Add(rdsds1);
    rvds1Pdf.LocalReport.DataSources.Add(rdsUser);
    rvds1Pdf.Visible = true;
    byte[] reportData = rvds1Pdf.LocalReport.Render("PDF");
    rvds1Pdf.Visible = false;

    The ReportHelper.SetReportEmbeddedResource method is inside the same class library as the RDLC because that's the only way I've found it to work and all it does is this:

    public static void SetReportEmbeddedResource(Microsoft.Reporting.WebForms.ReportViewer reportViewer, string reportName)
    {
                reportViewer.LocalReport.ReportEmbeddedResource = reportName;
    }
    

    All works perfectly until I deploy it to the UAT box. Then I receive "The report definition for report 'ClassLibrary1.Namespace.Blah.ds1.rdlc' has not been specified"!

    I used http://www.codeproject.com/Articles/3262/A-NET-assembly-viewer to double check that the RDLC is present as a Manifest Resource inside the DLL that's on the UAT box, which it is. So I'm a bit stumped why this is happening. I'm using a box standard web deployment project package the web site.

    Any thoughts/suggestions?

    Kind regards

    Sidharth

    Wednesday, August 1, 2012 3:01 PM

Answers

  • Okay, I think I have fixed the problem with the embedded report. I changed the SetReportEmbeddedResource method to:

    public static void SetReportEmbeddedResource(Microsoft.Reporting.WebForms.ReportViewer reportViewer, string reportName)
    {
        using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(reportName))
        {
            reportViewer.LocalReport.LoadReportDefinition(s);
        }
    }

    Kind regards
    Sidharth

    Tuesday, August 7, 2012 3:41 PM

All replies

  • Some more information about this. Locally I was using the built-in Cassini/VS Web server however on UAT I'm using IIS. I changed my local settings to use IIS and I get the same error!

    Any suggestions on what I can try or which IIS setting might cause this error?

    Kind regards

    Sidharth

    Tuesday, August 7, 2012 8:13 AM
  • Okay, I think I have fixed the problem with the embedded report. I changed the SetReportEmbeddedResource method to:

    public static void SetReportEmbeddedResource(Microsoft.Reporting.WebForms.ReportViewer reportViewer, string reportName)
    {
        using (Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream(reportName))
        {
            reportViewer.LocalReport.LoadReportDefinition(s);
        }
    }

    Kind regards
    Sidharth

    Tuesday, August 7, 2012 3:41 PM
  • Thanks, this helped me.

    For me, I was only getting the error when a) under full IIS (not IIS Express) AND b) compiled under Release configuration.

    I think it was working on the production machine for a time without this fix, and I'm not sure what changed. I'm guessing something to do with DLL load order. Anyway, implementing your code change makes this much more reliable.

    Notes: this was Report Viewer 2012 on Win7 dev machine and SBS 2008 server, under IIS, using .NET 4.5. Full error text:

    An error occurred during local report processing.
    The report definition for report 'XReport' has not been specified
    Object reference not set to an instance of an object.

    Wednesday, February 20, 2013 8:56 PM
  • Whick package?

    Kind regards

    Monday, April 29, 2013 2:38 PM