I'm using Visual Studio Professional 2012 on a Windows Server 2008 R2. When I run my MVC web application under IIS, I get the error:
Compiler Error Message: CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both
'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.DLL' and
'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'
After hours trying to resolve this, I discovered that when I "use Visual Studio Development Server" it works. This is good, but I'd like to get it working with IIS too.
Under IIS, the "detailed compiler output" includes:
c:\windows\system32\inetsrv> "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" /t:library /utf8output ...
/R:"C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.Common\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.Common.dll" ...
/R:"C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.dll" ...
/R:"C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\10.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll" ...
Under the VS Development Server (when I add a dummy error to my view), the only reference to ReportViewer is:
C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\11.0> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" /t:library /utf8output ...
/R:"C:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\11.0.0.0__89845dcd8080cc91\Microsoft.ReportViewer.WebForms.dll" ...
I've tried several things to try to get it working under IIS. There aren't any references to the 10.0.0.0 version of ReportViewer in my solution. I did a clean and rebuild. In IIS, the default web site did have a handler mapping referencing an older version of ReportViewer, which I removed. (I also tried adding a new handler mapping - no version specified - but that didn't work so I removed it.)
I tried the qualifyAssembly web.config node, as per The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both
And as per MSBuild Using Wrong Version of Assembly to Compile RDLC File I tried determining what VisualStudioVersion my build is using and even editing Microsoft.ReportingServices.targets (I put it back to what it was). This is the part that was getting to be over my head and I didn't want to mess anything up. Any ideas would be much appreciated.