My problem was resolved by following these steps:
I left dll links to my project, but I deleted them from the bin folder. Thus, the dll ceases to be regenerated in the Temporary ASP.NET Files folder, ending the conflict:
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\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\project\4ec9147f\d072b522\assembly\dl3\662a86a1\009c93d3_afeccc01\Microsoft.ReportViewer.WebForms.DLL'
The report viewer did not work as expected (the GAC only had versions 8 and 9 of the DLL). Then, Report Viewer 10.0.0.0 was installed on the server, and this time a new error appeared:
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\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'
It seemed strange to me that this conflict occurred between different versions of the DLL, and this time the solution was to add the following tag to the web.config file:
<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727"> <dependentAssembly> <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="b03f5f7f11d50a3a"/> <bindingRedirect oldVersion="9.0.0.0" newVersion="10.0.0.0"/> </dependentAssembly> </assemblyBinding>
Done. It worked without any conflicts, and it was possible to export reports.
My problem has been resolved, but I still have one doubt, and I hope someone helps me with this:
Why did the server have a conflict between two dlls from GAC_MSIL in different versions? Shouldn't the server only look at the version specified in my project and specified in Web.config? (10.0.0.0)
Does the machine.config file relate to?