0
votes

When I try to open the form holding the Report Viewer control, it displays this message:

An error occurred during local report processing.

The definition is not valid. Details: The report definition has an invalid target namespace

"http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" which cannot be upgraded.

The header of the rdlc file is:

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

The Reference set seems correct to me:

Microsoft.ReportViewer.WinForms
Runtime version: v2.0.50727
Version: 10.0.0.0

Target framework is: .NET Framework 4.5

Perhaps because this is an upgraded application, it still has included as Prerequisites:

Microsoft Visual Studio 2008 Report Viewer

I can find a support article stating that you can modify the schema version to, say, 2008, but that brings up a lot of compile errors.

So, how to resolve this?

1
Reference is pretty old. I'm using v15.0.0, using Microsoft.ReportingServices.ReportViewerControl.Winforms package in VS 2019.Reza Aghaei
For .NET 4.5 in VS 2019 I tried "Microsoft.ReportingServices.ReportViewerControl.Winforms" version="140.337.80" targetFramework="net45" which has a dependency to "Microsoft.SqlServer.Types" version="14.0.314.76" targetFramework="net45" without any problem. It's report viewer 14.0.0. And the schema version for reports: <Report xmlns="schemas.microsoft.com/sqlserver/reporting/2008/01/…" xmlns:rd="schemas.microsoft.com/SQLServer/reporting/reportdesigner">Reza Aghaei
The other thing is, the report definition for schema 2008 is different from schema 2016. For example for schema 2016, it should have ReportSections like the following:Reza Aghaei
<?xml version="1.0" encoding="utf-8"?> <Report xmlns="schemas.microsoft.com/sqlserver/reporting/2016/01/…" xmlns:rd="schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <ReportSections> <ReportSection> <Width>6.5in</Width> <Body> <Height>2in</Height> </Body> <rd:ReportTemplate>true</rd:ReportTemplate> <Page> </Page> </ReportSection> </ReportSections> </Report>Reza Aghaei
@RezaAghaei: Thanks very much! Will check this during the weekend.Gustav

1 Answers

1
votes

The references which you are using are pretty old while you are using the latest report schema. You need to use one or both of the following options:

  • You can change all the reports to a lower schema version
  • Upgrade the ReportViewer control and .NET framework to a later version.

The former, is not just updating the schema version because there are some new tags which are not supported in the older schema versions, for example ReportSections, ReportSection. To do this you can take a look at this post.

If your reports have already created with a valid schema 2016, the latter is better. Then you can update the ReportViewer control and .NET Framework:

You should make sure all other references and packages which you are using in the project are compatible with the .NET framework version which you are going to use.

To further reading about the latest version of the Report Viewer control take a look at: