Search code examples
asp.netreportviewergacreport-viewer2010

ASP.NET web site CS0433 ReportViewer exists in both xx and xx error


I'm struggling to resolve an error I'm experiencing in an ASP.NET web site project I inherited.

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'

We have the assembly and buildProvider references in the web.config

<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>

As well as the 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>

And the runtime reference. I even played around with setting the newVersion to 8.0.0.0, but that didn't help either

<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>

Any suggestions of what I might try are greatly appreciated


Solution

  • Figured it out! The bindingRedirect old version needed to include version 10 and the new version needed to be 8

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