7
votes

I am using Visual Studio 2010 and I installed "Microsoft Report Viewer 2012 Runtime" hoping to test the new reporting system in SQL 2012. After which I cleared for ref to "Microsoft.ReportViewer.WebForms" from my Web.config and removed the ReportViewer control from my toolbox and added the new version 11 ReportViewer.

I added the new control to a testing page and for one it adds this register to the test page:

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

and it adds these entry to the Web.config:

<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>

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

<handlers>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>

The control in the toolbox is the version 11 addition but the system keeps trying to ref the verion 10 edition. Also when I try to compile it I get the error:

The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL'
4
This fix issues for me. I was using an Azure VM for web application and DB server was another separate VM, so installing Report Viewer run-time was not helpful as it also need SQL Feature Pack installed. I just copied Microsoft.ReportViewer.Common folder from another server where that was working and boom ata2931977.blogspot.com/2015/06/… - Atta H.

4 Answers

16
votes

I think I had the exact same problem. If so, my solution was to delete all entries in web.config referencing ReportViewer, then do the same in References, build the project and then re-ADD a reportviewer in the page.

web.config will update with new handlers and assemblies for the newer version.

0
votes

I had the same error, and resolved it by doing the following:

  • In the aspx page (HTML code), updated the @Register Version value to correspond to the version of the assembly I was using, and updated the PublicKeyToken value with the correct value for the assembly.
0
votes

In your web config, it means you have specified both v 10 and 11 dlls. Remove one or the other.

0
votes

I have removed the following entry from package.config and it works

  <package id="MicrosoftReportViewerWebForms_v10" version="1.0.0" targetFramework="net45" />