0

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.

Community
  • 1
  • 1
KevinVictor
  • 524
  • 1
  • 5
  • 14
  • Check the reference properties in your project, make sure it says SpecificVersion false. – zaitsman Mar 12 '16 at 03:33
  • I gave it a try but got the same error about the two GAC versions, 10 and 11. Was reading up on it here (I would think that I _do_ want a specific version): http://stackoverflow.com/questions/24022134/how-exactly-does-the-specific-version-property-of-an-assembly-reference-work-i – KevinVictor Mar 14 '16 at 15:41
  • I also tried setting "Copy Local" to false, and deleted the DLL from the bin folder. That caused the error: "The type 'Microsoft.Reporting.WebForms.ReportViewer' is defined in an assembly that is not referenced. You must add a reference to assembly 'Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'." – KevinVictor Mar 14 '16 at 15:47

0 Answers0