Could not load file or assembly Microsoft.ReportViewer.XXX

Are you getting one of these errors?

Could not load file or assembly Microsoft.ReportViewer.WebForms

Could not load file or assembly Microsoft.ReportViewer.Common

Could not load file or assembly Microsoft.ReportViewer.ProcessingObjectModel

The problem is that some of these assemblies are supposed to be in the GAC, or at least when you create a basic application using .net, the application is expecting to find them.

You can deal with this in one of 2 ways.  You can find and download the ReportViewer.exe from Microsoft on the clients.  Or, you can copy the missing DLLs out of the GAC on your computer, and add them into your project.

Because I didn’t want to have to download extra software to my clients, I decided to take the second option.

To do this, follow the instructions here:

http://www.chrismay.org/2006/08/09/Accessing+DLLs+Stored+In+The+GAC.aspx

To pull the dlls out of the GAC (you can just copy them).

Then add them into your project at the root level (not as references, but just like you were adding another file).  Then, in visual studio, highlight them and select “Copy always” as the option for the “Copy to Output Directory” field.

This will make sure that the DLLs are copied into the BIN directory for deployment.

 

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s