Sunday, January 15, 2012

Microsoft.Reporting.WebForms.ReportViewer is not compatible

Scenario:
While integrating ReportViewer 10.0.0.0 with SP2010 I faced an old issue

The base class includes the field 'ReportViewer1', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).

As I hate to get into same problem again. Here's a list of things I tried to make it work.

Solution:
To understand the issue its a version mismatch issue. Check what's the latest version of ReportViewer ( Microsoft.Reporting.WebForms.dll) you have. On SP2010, its 10.0.0.0

If you are using any lower version i.e. 8.0.0.0 or 9.0.0.0 then you need to update it all places to avoid this.

Steps:
1. Check to make sure you don't have @Register directive pointing to old version. This you can do by searching '9.0.0.0' or '8.0.0.0' in complete project.

2. Clean the VS2010 solution and rebuild

3. Remove binary reference from Visual Studio project and add it again. Try Building it again

4. Check web.config to find you don't have entries pointing to old versions.

5. Sometime closing Project and opening it again helps

6. IISReset to ensure there are no caching issues with old versions