Visual Studio 2017报表RDLC设计器与工具箱中Report Viewer问题

时间:2024-01-21 23:45:57

原文:VS2017入门 RDLC入门之01

本系列所有内容为网络收集转载,版权为原作者所有。

VS2017初始安装后和VS2015一样,都没有ReportDesigner/ReportViewer

ReportViewer

1.在 Nuget 下载 Microsoft.ReportingServices.ReportViewerControl.Winforms

https://docs.microsoft.com/zh-cn/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started

2.工具箱中点右键,选择“选择项”,在.net framework组建选项卡中选择“浏览”,然后在你的工程根目录下的“\packages\Microsoft.ReportingServices.ReportViewerControl.Winforms.140.1000.523\lib\net40”目录下

选择“Microsoft.ReportViewer.WinForms.dll”文件,然后report viewer就被顺利添加到你的工具箱里了!

RDLC 报表设计器

3.

具体解决办法:

1. 点击Tools(工具) -> Extensions and Updates...(扩展和更新) ->联机 搜索 rdlc

Visual Studio 2017报表RDLC设计器与工具箱中Report Viewer问题

2. 在新窗口搜索栏中输入rdlc后搜索,结果中找到Microsoft Rdlc Report Designer for Visual Studio后进行安装(根据提示,应该是要关闭VS2017后再自动安装)。
3.在项目->添加新项的弹出窗口中,Visual C# 项中,选择 "報表" 或者 "報表精靈",如下图,选报表即可编辑报表

Visual Studio 2017报表RDLC设计器与工具箱中Report Viewer问题

如果在工具箱中没有出现ReportViewer控件,则执行如下操作:

报表查看器控件现作为 NuGet 包提供。 因此,默认情况下,Visual Studio 工具箱不会显示报表查看器控件。 通过执行以下操作可以向工具箱添加控件。
安装适用于上述 WinForms 或 WebForms 的 NuGet 包。

1.在工具箱中的任意位置单击右键,再选择“选择项...”。

Visual Studio 2017报表RDLC设计器与工具箱中Report Viewer问题

2.在 .NET Framework 组件中,选择“浏览”。

Visual Studio 2017报表RDLC设计器与工具箱中Report Viewer问题

3.从安装的 NuGet 包中选择“Microsoft.ReportViewer.WinForms.dll”或“Microsoft.ReportViewer.WebForms.dll”。

备注
NuGet 包将安装在项目的解决方案目录中。 dll 的路径将如下所示:{Solution Directory}\packages\Microsoft.ReportingServices.ReportViewerControl.Winforms.{version}\lib\net40 或 {Solution Directory}\packages\Microsoft.ReportingServices.ReportViewerControl.WebForms.{version}\lib\net40。
新控件将在工具箱内显示。 然后,如果需要,可将其移到工具箱内的其他选项卡中。
注意事项
此操作将在当前项目内添加一个对已安装 NuGet 包的引用。 工具箱中的项将保存到其他项目。 在新的解决方案/项目中安装 NuGet 包时,工具箱项可能引用较旧版本。
即便程序集不再可用,控件仍将保留在工具箱中。 如果已删除该项目,当你尝试从工具箱中添加控件时,Visual Studio 会引发错误。 要更正此错误,请从工具箱中删除控件,并使用上述步骤重新添加。