命名空间“Microsoft”中不存在类型或命名空间名称“Reporting”

我只是得到以下错误:

命名空间“Microsoft”中不存在类型或命名空间名称“Reporting”(您是否缺少程序集引用?)

将此添加到我的代码后:

protected global::Microsoft.Reporting.WebForms.ReportViewer ReportViewer1; 

我已经看到一些解决方案,我必须添加一些程序集。 但他们都没有工作。 这是一个例子:

   

谁能帮我这个?

在我的情况下,我需要在麻烦的机器上实际安装Microsoft Report Viewer。

  • Report Viewer 2010 (版本= 10)
  • Report Viewer 2012 (版本= 11)
  • 报告查看器2015

当然,其他的可用,可以从Version=在dll上找到哪一个需要。 就我而言,我需要第11版(2012年版)。

我是通过右键单击项目中的References文件夹然后选择Add Reference来完成的 。 然后将Assemblies> Extensions> Microsoft.ReportViewer添加到引用。

所有这些安装根本不适用于我。 在Visual Studio 2015中对我有用的是从NuGet安装以下两个包(我只需要这两个)(菜单Project> Manage NuGet Packages):

  • Microsoft.ReportViewer.Common.VS2010
  • Microsoft.ReportViewer.WinForms.VS2010

引用自动添加到当前项目中。

只需安装SSDT 。 然后,您需要删除损坏的引用并从Assemblies> Extensions重新添加它。

从以下位置导入:C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ ReportViewer \ Microsoft.ReportViewer.WebForms.dll

从Nuget Package Manager安装ReportViewer