Microsoft ASP.NET ReportViewer分析器错误

时间:2009-05-04 14:41:04

标签: asp.net reportviewer

我一直在网站上使用MS ReportViewer组件一段时间了,但最近我收到了如下所示的错误。

  

分析器错误消息:基类   包括字段'xyz',但它的   类型   (Microsoft.Reporting.WebForms.ReportViewer)   与...的类型不兼容   控制   (Microsoft.Reporting.WebForms.ReportViewer)。

<rsweb:ReportViewer ID="xyz" runat="server" Width="100%" Font-Names="Verdana" Font-Size="8pt" Height="400px" ProcessingMode="Local" ShowExportControls="false">

现在,我在Visual Studio和生产中都遇到了这个错误。我在生产中安装了ReportViewer Redistributable。

我在某个方面错过了我的项目中的引用,还是什么?

8 个答案:

答案 0 :(得分:6)

我发现了答案:不知何故,对Microsoft.Reporting.WebForms版本9的引用已切换到版本8.这导致了错误。因此,删除引用并添加正确的引用版本似乎已经解决了问题。

编辑:

嗯,根据.vbproj文件的先前版本,它是对9的引用,尽管项目引用属性屏幕告诉我8.总之我不太确定是什么设法搞砸了,但是它似乎现在正在运作。

如果有人经历过这方面或有一些见解,请提供帮助。

答案 1 :(得分:2)

在干净安装之后,我的项目没有编译,因为对dll的引用被破坏了,所以我删除了它并再次添加它,然后使用ReportViewer的网页给出了一个解析器错误:

The base class includes the field 'rprtReportsViewer', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).

我在网页上找到了一个版本号与我刚刚添加的版本号不同的引用:

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

我将版本更改为9.0.0.0,这次刷新页面时出现编译错误:

CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'

然后我搜索了“Microsoft.ReportViewer”的解决方案,并在compilation.config中找到了更多引用:

    <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
    <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
  </assemblies>
  <buildProviders>
    <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  </buildProviders>

我也在这里更改了版本号,并且它停止了错误

答案 2 :(得分:2)

您可能还需要从\ bin文件中删除:

     Microsoft.ReportViewer.Common.dll
     Microsoft.ReportViewer.ProcessingObjectModel.dll
     Microsoft.ReportViewer.WebForms.dll
     Microsoft.ReportViewer.WinForms.dll

我刚将它们移动到子目录中。

答案 3 :(得分:2)

检查您的页面rdlc版本,如

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

答案 4 :(得分:0)

遇到同样的问题。使用SQL Server 2005和SQL Reporting清理Windows 2008 Server安装。服务器托管该站点。安装了ReportViewer 2008 SP1。 Web.config引用版本9.0.0.0。

出现相同的错误消息:基类包括字段但其类型(Microsoft.Reporting.WebForms.ReportViewer)与控件类型(Microsoft.Reporting.WebForms.ReportViewer)不兼容。

在线搜索,很多人都遇到了同样的问题。有人建议手动编辑项目文件。 我设法通过在解决方案资源管理器中设置特定版本= True(版本= 9.0.0.0)来修复它 - > [Web项目名称] - &gt;参考 - &gt; Microsoft.Reporting.WebForms-&gt;属性。

在其中一个环境中,我们还发现了Microsoft.Reporting dll在web bin文件夹中。并且,它们与GAC中注册的dll相冲突。删除dll解决了这个问题。

答案 5 :(得分:0)

我在生产服务器上遇到此问题。我安装了正确版本的ReportViewer,并确保项目中的所有引用都指向正确的版本。但是,我仍然遇到错误。

最终我通过转到'临时ASP.NET文件'并删除我的应用程序的文件来解决问题。要执行此操作,您需要先停止应用程序。这解决了问题。在DEV服务器上我没有遇到这个问题,因为在安装ReportViewer之后我重新启动了机器。

希望这有助于某人。在我解决了这个特殊的“挑战”之前,我拉了很多头发。

答案 6 :(得分:0)

参考文献 - &gt; (Microsoft.ReportViewer.WebForms),单击鼠标右键。

“指定版本”选项,将其保留为false。

之后,只需保存并再次运行。

答案 7 :(得分:-2)

我遇到了同样的错误。对我有用的是删除引用Microsoft.ReportViewer.WebForms并再次添加它。