我正在使用 Visual Studio 2010 并且我安装了“Microsoft Report Viewer 2012 Runtime”,希望在 SQL 2012 中测试新的报告系统。之后我从我的 Web.config 中清除了对“Microsoft.ReportViewer.WebForms”的引用并删除了 ReportViewer从我的工具箱控制并添加了新版本 11 ReportViewer。
我将新控件添加到测试页面,并将此寄存器添加到测试页面:
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
并将这些条目添加到 Web.config:
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
</httpHandlers>
<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
工具箱中的控件是版本 11 的添加,但系统一直在尝试引用版本 10 版本。此外,当我尝试编译它时,我收到错误:
The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL'
最佳答案
我想我遇到了完全相同的问题。如果是这样,我的解决方案是删除 web.config 中引用 ReportViewer 的所有条目,然后在 References 中执行相同操作,构建项目,然后在页面中重新添加一个 reportviewer。
web.config 将使用新版本的新处理程序和程序集进行更新。
关于visual-studio-2010 - 报表查看器 11 (2012) Visual Studio 2010,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12199724/