RDLC报表在从Visual Studio 2015更改为Visual Studio 2017后停止工作。

14
我在Visual Studio 2017中有一个AspNet MVC项目,之前是在Visual Studio 2015中开发的。该项目包含许多rdlc文件,在我编辑其中一个文件之前都可以正常工作。现在,当我尝试从编辑后的rdlc下载pdf时,会出现以下错误:报告的定义无效或不受此版本的Reporting Services支持。报告定义可能是使用较新版本的Reporting Services创建的,或者包含基于Reporting Services模式不规范或无效的内容。详情:报告定义具有无法升级的无效目标命名空间'http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition'。
The rdlc编辑后,其命名空间从http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition更改为http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition
该项目正在运行.net框架4.6.2,并已安装Microsoft.ReportViewer.Runtime.Common.12.0.2402.15和Microsoft.ReportViewer.Runtime.WebForms.12.0.2402.15 nuget包。
3个回答

37

我曾经遇到同样的问题,通过卸载NuGet包Microsoft.ReportViewer.Runtime.CommonMicrosoft.ReportViewer.Runtime.WebForms并安装包Microsoft.ReportingServices.ReportViewerControl.WebForms.140.340.80解决了问题。需要注意的是,由于我使用ReportDataSource类来呈现我的报表,因此我不得不添加对System.Windows.Forms的引用,因为这个类有一个依赖项。


3
https://www.nuget.org/packages/Microsoft.ReportingServices.ReportViewerControl.WebForms/ 安装包 Microsoft.ReportingServices.ReportViewerControl.WebForms -Version 140.802.134 - Roberto Hernandez
7
Fidel,感谢您清晰地提出了这个问题,谢谢Lilliam的回答。我已经寻找解决方案3天了。 对于那些正在寻找WPF应用程序的解决方案,您需要安装此软件包:Microsoft.ReportingServices.ReportViewerControl.Winforms.140.340.80 - Ali
我在WebApi 2.0中遇到了同样的问题...情况有所不同,我没有使用Microsoft.ReportViewer.Runtime.WebForms,我只使用了Microsoft.ReportViewer.Runtime.Common... - DarioN1
这个解决方案可行,同时确保你的RDLC报表的“生成操作”属性设置为“内容”,在我的情况下它被设置为“嵌入式资源”,当我发布到生产服务器时会生成错误。如果你的RDLC报表使用.resx文件,也要验证它们是否存在于各自的文件夹中。 - Wilson
另一件需要考虑的事情是,安装版本为14的 "Microsoft.SqlServer.Types" NuGet包。当然,我们的项目是使用dotnet编写的,而我们的数据库是Microsoft SQL Server。 - keivan kashani
无法找到版本140,只有150。尝试从SSRS 2005升级到2016仍然会出现以下错误:“基类包括字段'ReportViewer',但其类型(Microsoft.Reporting.WebForms.ReportViewer)与控件的类型(Microsoft.Reporting.WebForms.ReportViewer)不兼容。” - ARLibertarian

0

-2

我在解决方案资源管理器中右键单击rdlc文件,选择从服务器替换,这样问题就解决了。我认为vs 2017试图更新模式以使用不同版本的sql server,并且获取原始报告定义可以解决此问题。也许是这样,我不确定,但对我有效。


它将模式更改回了这个:<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">,而不是像这样的:<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">。 - Kevin G Brooks
我不确定你的答案是关于什么的。你能再解释一下吗? - Fidel Garcia
这个回答既没有确定问题,也没有提供永久解决方案 - 显然,提问者需要能够编辑RDLC文件,而不仅仅是从服务器中获取它。 - Ben

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接