Report Viewer Schema 2016

1

When I add a parameter to a report of ReportViewer it's happening from the version of schema to 2016, which causes me the following error when trying to render the report

  

Message: Test method   Syns.Web.Test.Reports.DemoReportTest.MyTestMethodAsync   threw exception:   Microsoft.Reporting.WebForms.LocalProcessingException: An error   occurred during local report processing. --- >   Microsoft.Reporting.DefinitionInvalidException: The definition of the   report   'D: \ Projects \ Syns \ Syns \ Syns.Web \ Reports \ DemonstratorReport.rdlc'   is invalid. --- >   Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:   The report definition is not supported by this version of   Reporting Services. This could be the result of publishing to report   definition of a later version of Reporting Services, or that   report definition contains XML that is not well-formed or the XML is   not valid based on the Report Definition schema. Details: The report   definition has an invalid target namespace   ' link '   which can not be upgraded.

The code I use to render the report is basically the following

public async Task<ReportModel> Report(int demonstrativoId, string path)
{
    var demonstrativo = await Demonstrativo(demonstrativoId);
    var demonstrativos = new List<Demonstrativo>()
    {
        demonstrativo
    };

    var procedimentos = await DemonstrativoProcedimento(demonstrativoId);

    LocalReport relat = new LocalReport
    {
        //caminho do arquivo rdlc
        ReportPath = Path.Combine(path, "DemonstrativoReport.rdlc"),
        EnableExternalImages = true,
    };

    //vinculando dataset ao objeto relat            
    relat.DataSources.Add(new ReportDataSource
    {
        Name = "DemonstrativoDataSet",
        Value = demonstrativos
    });
    relat.DataSources.Add(new ReportDataSource()
    {
        Name = "DemonstrativoProcedimentoDataSet",
        Value = procedimentos,
    });
    relat.SetParameters(new ReportParameter("NumeroDemonstrativoParam", demonstrativo.Numero.ToString()));

    //definindo tipo que o relatório será renderizado
    string reportType = "PDF";

    //configurações da página ex: margin, top, left ...
    string deviceInfo =
    "<DeviceInfo>" +
    "<OutputFormat>PDF</OutputFormat>" +
    "<PageWidth>8.27in</PageWidth>" +
    "<PageHeight>11.69in</PageHeight>" +
    "<MarginTop>0.19685in</MarginTop>" +
    "<MarginLeft>0.19685in</MarginLeft>" +
    "<MarginRight>0.19685in</MarginRight>" +
    "<MarginBottom>0.19685in</MarginBottom>" +
    "</DeviceInfo>";

    byte[] bytes;
    //Renderizando o relatório o bytes
    bytes = relat.Render(reportType, deviceInfo, out string mimeType, out string encoding, out string fileNameExtension, out string[] streams, out Warning[] warnings);

    return new ReportModel(bytes, mimeType);
}

If I change the ReportViewer schema for 2008, remove some tags from the 2016 version, my code works, however whenever I re-edit the report, the version goes back to 2016.

I made an example and uploaded to github, the difference of the ReportViewer file can be seen in the commit link

    
asked by anonymous 24.11.2017 / 18:48

0 answers