-1

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?

Gustav
  • 53,498
  • 7
  • 29
  • 55
  • Reference is pretty old. I'm using v15.0.0, using `Microsoft.ReportingServices.ReportViewerControl.Winforms` package in VS 2019. – Reza Aghaei Jan 31 '20 at 00:09
  • 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: – Reza Aghaei Jan 31 '20 at 00:28
  • The other thing is, the report definition for schema [2008](http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition/ReportDefinition.xsd) is different from schema 2016. For example for schema 2016, it should have ReportSections like the following: – Reza Aghaei Jan 31 '20 at 01:25
  • 6.5in 2in true – Reza Aghaei Jan 31 '20 at 01:25
  • @RezaAghaei: Thanks very much! Will check this during the weekend. – Gustav Jan 31 '20 at 07:42
  • @RezaAghaei: I updated the _ReportViewer_ control and designer to [v15](https://www.nuget.org/packages/Microsoft.ReportingServices.ReportViewerControl.Winforms/150.1400.0), ran the required updated of the report design files, changed target to 4.6, and removed an old file, ADODB.dll, which was set to be included. If you add an answer, I can mark that as the answer as you were the only to care. Thanks! – Gustav Feb 01 '20 at 16:16
  • Great! I'll post an answer :) – Reza Aghaei Feb 01 '20 at 16:21

1 Answers1

1

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:

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398