Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both

Tags:

asp.net

I have a ASP.NET application which was referring Microsoft.ReportViewer.WebForms of version 9.0.0.0, I changed to refer to Microsoft.ReportViewer.WebForms of version 11.0.0.0. Now when I run my application on 2 of the machines I get following error

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL'

I have ensured that everywhere in my web.config version number is updated to 11.0.0.0

like image 636
Ojas Maru Avatar asked Feb 22 '13 10:02

Ojas Maru


Video Answer


1 Answers

I tried adding dependentAssembly in web.config but that did not help.

<dependentAssembly>
  <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="89845dcd8080cc91" />
  <bindingRedirect oldVersion="8.0.0.0-10.0.0.0" newVersion="11.0.0.0" />
</dependentAssembly>

However it did not help as PublicKeyToken has changed in 11.0.0.0 dll.

Finally I was able to resolve the issue by adding qualifyAssembly node in web.config

<qualifyAssembly partialName="Microsoft.ReportViewer.WebForms" fullName="Microsoft.ReportViewer.WebForms,version=11.0.0.0,culture=neutral,publicKeyToken=89845dcd8080cc91" />
like image 51
Ojas Maru Avatar answered Sep 21 '22 08:09

Ojas Maru