Could not load file or assembly 'Microsoft.ReportViewer.WebForms'
Asked Answered
I

15

69

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.

Indite answered 11/5, 2013 at 4:40 Comment(1)
C
68

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)

Calcifuge answered 5/9, 2013 at 12:5 Comment(3)
also needed to restart the application pool before the newly installed dll's were picked up.Drown
Update: Consider using NUGET - see section "Updating an existing project to use the ReportViewer control" in Microsoft article "Integrating Reporting Services Using ReportViewer Controls - Get Started". After updating it via NUGET check the "CopyLocal" setting (should be set to true).Conserve
Thanks. I needed to install Microsoft® System CLR Types first before I installed the ReportViewer.msi but after installing both my application now build properly. Thanks again.You can get the installer here: microsoft.com/en-ph/download/details.aspx?id=29065Taken
M
48

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

Merwin answered 8/10, 2015 at 11:7 Comment(6)
This worked for me. I was in need to getting v12 .dlls on a build server (TeamCity) that only had v11 available. There's a 2015 release package available on NuGetTanguy
this helped thanks , there are many authors in nuget which you can choose from but as suggested in answer i used package created by Author Fornax and here is link to install via nugetFavrot
I think this answer save a day for meDzoba
This worked for me, though I didn't specify the 2012.runtime. Instead I did "Install-Package Microsoft.Report.Viewer" in the Package Manager Console.Siccative
For version 11.0.0 I used that Microsoft.ReportViewer package which you can see in the results of the picture and there was no problemConserve
This worked for me, just stopped, installed the package, F5 and voilà.Incunabula
C
23

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

Compressed answered 12/9, 2013 at 6:20 Comment(3)
I followed the steps above and have referenced Microsoft.ReportViewer.WebForms (v11) but cannot locate Microsoft.ReportViewer.Common (v11). Any ideas why I cannot see the common library?Zoophilia
I found Microsoft.ReportViewer.Common in C:\Windows\assembly\GAC_MSIL\..., thanks to this answer.Melisamelisande
I installed ReportViewer as in a previous answer but that didn't work. This answer got me to a point where I was getting a new exception that told me to add ReportViewer to my web.config file. Once I fixed web.config I was sorted.Latex
S
9

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.

Sami answered 11/4, 2015 at 16:0 Comment(1)
validate="false", system.webServer validation validateIntegratedModeConfiguration="false" and preCondition="integratedMode" are required ?Mordacious
C
2

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.

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

Codie answered 17/3, 2019 at 7:6 Comment(0)
O
1

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.

Outclass answered 20/5, 2014 at 17:5 Comment(0)
A
1

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" %>
Amaryllidaceous answered 22/2, 2016 at 14:34 Comment(2)
So, that is simply not necessary anymore?Mccandless
@Mccandless Well, nothing simple about ReportViewer :) but that did it for me.Amaryllidaceous
V
1

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.

Vieva answered 20/10, 2016 at 12:35 Comment(0)
C
1

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.

Cufic answered 3/6, 2017 at 22:47 Comment(0)
P
1

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.

Poynter answered 12/12, 2017 at 13:37 Comment(0)
S
0

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.

Streetman answered 11/5, 2013 at 4:48 Comment(2)
hey thanks @Amit Mittal , I already have added reference to Microsoft.ReportViewer.WebForms.dll, as wel as to Microsoft.ReportViewer.Common.dllIndite
Since you are getting error after uploading, this means that the report viewer dlls are not installed at the sserver. That is why you have to either install report viewer controls as server or manually upload dll files to the bin directory.Streetman
W
0

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

Wowser answered 24/5, 2018 at 9:15 Comment(0)
D
0

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.

Deweese answered 13/6, 2019 at 9:38 Comment(0)
D
0

I had the same problem.

I fixed the problem by installing Microsoft-Report-Viewer-2010-Redistributable ("ReportViewer.exe)

Deberadeberry answered 9/1, 2023 at 11:52 Comment(0)
A
0

You are missing Microsoft-Report-Viewer-2010-Redistributable in your server. Download it and install

Artieartifact answered 26/9, 2023 at 8:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.