ASP.NET网站CS0433 ReportViewer存在xx和xx错误

时间:2018-02-28 22:24:36

标签: asp.net reportviewer gac report-viewer2010

我正在努力解决我在我继承的ASP.NET网站项目中遇到的错误。

Error   CS0433  
The type 'ReportViewer' exists in both 
'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 
'Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

我们在web.config

中有assembly和buildProvider引用
<assemblies>
   ...
   <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"/>
   <add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
   ...
</assemblies>
<buildProviders>
   <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>

以及httpHandler

<httpHandlers>
   ...
   <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
   ...
<httpHandlers>

和运行时引用。我甚至将newVersion设置为8.0.0.0,但这无济于事

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="b03f5f7f11d50a3a"/>
    <bindingRedirect oldVersion="8.0.0.0" newVersion="10.0.0.0"/>
  </dependentAssembly>
</assemblyBinding>    
</runtime>

非常感谢任何有关我可能尝试的建议

1 个答案:

答案 0 :(得分:0)

想出来! bindingRedirect旧版本需要包含版本10,新版本需要为8

<bindingRedirect oldVersion="8.0.0.0-10.0.0.0" newVersion="8.0.0.0"/>