silanos_1

Analytics

ad silanors2

2011年4月11日 星期一

[ReportViewer]解決 編譯器錯誤訊息: CS0433: 'c:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\ 8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' 和 'c:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\ 9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' 兩者中都有型別 'Microsoft.Reporting.WebForms.ReportViewer' =>升級到9.0 問題


問題

編譯器錯誤訊息: CS0433: 'c:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\ 8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' 和 'c:\WINDOWS\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\ 9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' 兩者中都有型別



解決方法


這是由於舊專案(Visual Studio2005)升級到2008版本後,web.config 中有關report viewer的版本為8.0導致
由於Visual Studio 2008並不支援由Visual Studio 2005設計出來的報表專案,所以無法直接由Visual Studio 2008開啟由 Visual Studio 2005設計的報表專案。
解決方式:
1.Web.config
<controls>部分加入:
<add tagPrefix="rsweb"  assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" namespace="Microsoft.Reporting.WebForms" />
<assemblies>部分移除8.0版本並加入:
<add assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
    <add assembly="Microsoft.ReportViewer.Common, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>

<buildProviders>部分移除8.0版本並加入:
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common,Version=9.0.0.0 , Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<httpHandlers>部分移除8.0版本並加入:
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    validate="false" />


此文參考:來源
2.若發生(Microsoft.Reporting.WebForms.ReportViewer) 與控制項的型別 (Microsoft.Reporting.WebForms.ReportViewer) 不相容。 這樣的錯誤訊息,則將原專案的參考Microsoft.ReportViewer.WebForms移除,再重新加入9.0版本的Binary

沒有留言:

as silanors3

熱門文章

bloggerads