MS Report踩坑与 /reporting/2016/01/reportdefinition cannot be upgraded 解决方案

最近在做MS Report相关的内容,遇到了个坑,记录一下。

环境: VS2019 + RDLC Designer 15.3.1 + Microsoft.ReportViewer.Common 10 + Microsoft.ReportViewer.Winfom 10

 

问题: 运行报表时会出现 The report definition has an invalid target namespace ‘http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition‘ which cannot be upgraded. 

 

解决方案一; 根据*提供的方法(reporting services - SSRS report definition is newer than Server - Stack Overflow)。

用xml编辑器或文本模式打开RDLC文件,然后

1、把http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition改为http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition

2、删除  <ReportSections>和<ReportSection>(只删除这两个,里面的内容不删)

3、删除整个<ReportParametersLayout>

 

缺点: 差不多每次更改报表可能都要手动执行以上步骤。

 

解决方案二:使用Microsoft.ReportingServices.ReportViewerControl.Winforms 140 或 150 代替Microsoft.ReportViewer.Common 10 + Microsoft.ReportViewer.Winfom 10

 

原因与分析:估计是RDLC Designer的问题,新建一个空白报表时 xml的namespace是 2008的,但如果增加了参数后久变成了2016。用解决方案一临时解决后,如果以后需要编辑、调整用到参数的控件,和新增、修改参数,都会导致xml的namespace从2008变成2016。而Microsoft.ReportViewer.Common 10 和 Microsoft.ReportViewer.Winfom 10 无法处理2016的格式。

MS Report踩坑与 /reporting/2016/01/reportdefinition cannot be upgraded 解决方案

上一篇:使用mailpopbox构建个人独享EmailServer


下一篇:epoll学习代码