无法加载文件或程序集“Microsoft.ReportViewer.Webforms”
无法加载文件或程序集“Microsoft.ReportViewer.Common”
我在Visual Studio 2015中遇到了这个问题。
原因:
缺少对 Microsoft.ReportViewer.Webforms dll 的引用。
可能的解决方法:
步骤1:
将 "Microsoft.ReportViewer.Webforms.dll" 添加到解决方案中。
导航到Nuget软件包管理器控制台,如下所示:
“工具-->NugetPackageManager-->Package Manager Console”。
然后在控制台中输入以下命令
PM>Install-Package Microsoft.ReportViewer.Runtime.WebForms
然后它将在“..\packages\Microsoft.ReportViewer.Runtime.WebForms.12.0.2402.15\lib”(您的项目文件夹路径)中安装Reportviewer.webforms dll
和在“..\packages\Microsoft.ReportViewer.Runtime.Common.12.0.2402.15\lib”(您的项目文件夹路径)中安装ReportViewer.Runtime.Common dll。
步骤2:
删除现有的 “Microsoft.ReportViewer.WebForms” 引用。我们需要在解决方案中引用这些dll文件,可通过“右键单击解决方案 > 引用 --> 添加引用 -->浏览”来实现。从上述路径添加这两个dll文件。
步骤3:
更改web.Config文件以指向Visual Studio 2015。将Microsoft.ReportViewer.WebForms和Microsoft.ReportViewer.Common版本11.0.0.0注释掉,并取消注释Microsoft.ReportViewer.WebForms和Microsoft.ReportViewer.Common Version = 12.0.0.0,如下图所示。
Microsoft.ReportViewer.Webforms/Microsoft.ReportViewer.Common
也请参考下面的链接。
无法加载文件或程序集 'Microsoft.ReportViewer.WebForms'
MicrosoftReportViewer.Common
和Microsoft.ReportViewer.WebForms
并将复制本地设置为 true。我想答案中列出的其他要求取决于所使用的报告类型。 - T3.0