Could not load file or assembly 'Microsoft.ReportViewer.WebForms'

asp.netReporting ServicesReportviewer

asp.net Problem Overview


I am trying to use the report viewer in asp.net and have uploaded my site. However, when my page containing the report viewer is loaded, it shows the following error:

> Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

This is my first time deploying an ASP.NET website, so I'm not sure what the problem is.

asp.net Solutions


Solution 1 - asp.net

This link gave me a clue that I didn't install a required update (my problemed concerned version nr, v11.0.0.0)

ReportViewer 2012 Update 'Gotcha' to be aware of

I installed the update SQLServer2008R2SP2

I downloaded ReportViewer.msi, which required to have installed Microsoft® System CLR Types for Microsoft® SQL Server® 2012 (look halfway down the page for installer)

In the GAC was now available WebForms v11.0.0.0 (C:\Windows\assembly\Microsoft.ReportViewer.WebForms v11.0.0.0 as well as Microsoft.ReportViewer.Common v11.0.0.0)

Solution 2 - asp.net

I've installed Microsoft.ReportViewer.2012.Runtime nuget package and problem has been solved without installing ReportViewer.msi or sql feature pack 12

enter image description here

Solution 3 - asp.net

You need to reference both Microsoft.ReportViewer.WebForms and Microsoft.ReportViewer.Common and set the CopyLocal property to true. This will result in the dll's being copied to our bin directory (both are necessary).

Solution 4 - asp.net

I've solved the problem by copying both

  • Microsoft.ReportViewer.WebForms.dll from C:\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer
  • and Microsoft.reportviewer.common.dll from C:\Program Files\Microsoft Office\Office15\ADDINS\PowerPivot Excel Add-in

into bin folder (website).

Of course web.config must have:

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

    <assemblies>

        <add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
        <add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
    </assemblies>

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

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
            <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        </handlers>
    </system.webServer>

And that's all. For me is ok.

Hope this helps.

Solution 5 - asp.net

Updating ReportViewer should works. Use below instruction to install updated ReportViewer from Nuget Package Manager console.

> Install-Package > Microsoft.ReportingServices.ReportViewerControl.WebForms

Just add below assembly reference in your aspx file.

> <%@ Register Assembly="Microsoft.ReportViewer.WebForms, > Version=15.0.0.0" Namespace="Microsoft.Reporting.WebForms" > TagPrefix="rsweb" %>

Here, 15.0.0.0 is the version number of the ReportViewerControl.WebForms that was installed in my VS. Please check Reference of the Solution to confirm the version number. No need to add PublicTokens (if multiple installation exists, it may creates trouble again).

Solution 6 - asp.net

I ran into the same error. My web app was pointed towards report viewer version 10.0 however if 11.0 is installed it adds a redirect in the 10.0 .dll to 11.0. This became an issue when 11.0 was uninstalled as this does not correct the redirect in the 10.0 .dll. The fix in my case was to simply uninstall and reinstall 10.0.

Solution 7 - asp.net

I had this error with an old webforms app. Turns out there was a line in the markup causing the issue. I removed it and the error disappeared.

<%@ Register assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" namespace="Microsoft.Reporting.WebForms" tagprefix="rsweb" %>

Solution 8 - asp.net

I had this error when going from version 10.0.0.0, i.e. "Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

to version 11.0.0.0, i.e.

"Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"

It took a while until I understood that not only the version was changed but also the public token key, as you can see above.

Solution 9 - asp.net

I had the same error for a different package. My problem was that a dependent project was referencing a different version. I changed them to be the same version and all was good.

Solution 10 - asp.net

My solution is:

  1. Copy dll Microsoft.ReportViewer.WebForms.dll into Bin folder in your project.
  2. Remove your reference.
  3. Add new reference from bin folder.

I hope this can help.

Solution 11 - asp.net

Upload the file Microsoft.ReportViewer.WebForms.dll to your bin directory of your web applicaion.

You can find this dll file in the bin directory of your local web application.

Solution 12 - asp.net

My trial version of DevExpress had expired. Try renewing it again.

Solution 13 - asp.net

In order to Run Report Viewer On server with Data from Server

A) Go to Project Property ----> Select Reference ------> Add Reference

1) Import (Microsoft.ReportViewer.Common.dll)-----> (Path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer")

2) Import (Microsoft.ReportViewer.ProcessingObjectModel.dll) -----> (Path "C:\Windows\Assembly\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel")

3) Import (Microsoft.ReportViewer.WebForms.dll)-----> (Path "C:\Program Files (x86)\Microsoft Visual Studio 10.0\ReportViewer")

B) In Above three DLL set its "Local Copy" to True so that while Building Deployment Package it will getcopied to "Bin" folder.

C) Publish the Solution

D) After that Upload all the files along with "Bin" folder with the help of "File Zilla" software to "Web Server".

E) This will install DLL on server hence, client is not required to have "Report Viewer.dll".

This worked for me.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKrishnaView Question on Stackoverflow
Solution 1 - asp.netEricGView Answer on Stackoverflow
Solution 2 - asp.netRamy YousefView Answer on Stackoverflow
Solution 3 - asp.netjmorenoView Answer on Stackoverflow
Solution 4 - asp.netCDSwSrlView Answer on Stackoverflow
Solution 5 - asp.netmirzapinkuView Answer on Stackoverflow
Solution 6 - asp.netuser3657646View Answer on Stackoverflow
Solution 7 - asp.netSteve GreeneView Answer on Stackoverflow
Solution 8 - asp.netGunnarSView Answer on Stackoverflow
Solution 9 - asp.netTaranView Answer on Stackoverflow
Solution 10 - asp.netHamlet MendezView Answer on Stackoverflow
Solution 11 - asp.netAmit MittalView Answer on Stackoverflow
Solution 12 - asp.netLutaaya Huzaifah IdrisView Answer on Stackoverflow
Solution 13 - asp.netHemal ShahView Answer on Stackoverflow