2009-05-04 80 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並再次添加它。