The base class includes the field ‘XXX’, but its type is not compatible with the type of control Microsoft.Reporting .WebForms.ReportViewer

When I tried to upgrade asp.net solution that had been developed via Visual Studio 2008 to a SharePoint solution, I got the following error

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

Specifically when I tried to use the report viewer control .

1

Cause:

The “Microsoft.Reporting.WebForms” reference is not added to SharePoint Solution.

2

After Adding the “Microsoft.Reporting.WebForms” reference then I tried to deploy the SharePoint solution again. but unfortunately,  I got another error 😦

CS0433: 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
\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dl

3

I found out the report viewer control reference to”Microsoft.ReportViewer.WebForms” Version 10.but in the web config of the SharePoint Web Application it’s referenced to “Microsoft.ReportViewer.WebForms” Version 9.

5

Solution,

  • I removed the reference of  “Microsoft.ReportViewer.WebForms”  with Version 10.
  • I added “Microsoft.ReportViewer.WebForms” reference with Version 9.
  • I registered the assembly with the same version in front code of my visual web part.

4

Note : Try to use the version of reference that matched with the version that already used in the web config of SharePoint Web Application also with that registered in front code.

Enjoy 🙂

Advertisements

One thought on “The base class includes the field ‘XXX’, but its type is not compatible with the type of control Microsoft.Reporting .WebForms.ReportViewer

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s