2009-05-04 36 views
10

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

Parser Error Message: The base class includes the field 'xyz', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (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。

我在某种程度上缺少了我的项目中的参考,或者什么?

回答

6

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

编辑:

那么按照以前版本的.vbproj文件,它是9的引用,尽管该项目引用属性屏幕告诉我8总之我真的不知道是什么设法搞砸了,但它似乎现在正在工作。

如果有人经历过这个或有一些洞察力,请捐助。

+0

但告诉我一件事你是如何从asp.net应用程序中删除引用的? – 2014-01-15 07:45:49

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)不兼容。

在线搜索和许多人遇到相同的问题。有些人建议手动编辑项目文件。 我设法通过在解决方案资源管理器 - > [Web项目名称] - >参考 - > Microsoft.Reporting.WebForms->属性中设置Specific Version = True(Version = 9.0.0.0)来修复它。

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

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”的解决方案,发现编译的详细引用。配置:

<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

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

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

我刚刚搬到他们到一分目录。

0

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

最终,我通过转到“Temporary ASP.NET Files”并删除了我的应用程序的文件来解决了这个问题。要做到这一点,你需要先停止应用程序。这就解决了这个问题。在DEV服务器上我没有遇到这个问题,因为在安装ReportViewer之后,我重新启动了机器。

希望这可以帮助别人。在解决这个特殊的“挑战”之前,我拉了很多头发。

0

参考 - >(Microsoft.ReportViewer.WebForms),单击鼠标右键。

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

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

2

检查你的页面RDLC版本一样

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

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