csc.exe包括两个版本的GAC_MSIL \ Microsoft.ReportViewer.WebForms - 在IIS

时间:2016-03-11 16:57:31

标签: asp.net iis visual-studio-2012 msbuild reportviewer

我在Windows Server 2008 R2上使用Visual Studio Professional 2012。当我在IIS下运行我的MVC Web应用程序时,我收到错误:

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'

在尝试解决此问题后数小时,我发现当我“使用Visual Studio开发服务器”时,它可以正常工作。这很好,但我也想让它与IIS一起工作。

在IIS下,“详细的编译器输出”包括:

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" ...

在VS Development Server下(当我向我的视图添加一个虚拟错误时),对ReportViewer的唯一引用是:

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" ...

我已经尝试了几种方法来尝试让它在IIS下工作。在我的解决方案中没有对10.0.0.0版本的ReportViewer的引用。我做了一个干净的重建。在IIS中,默认网站确实有一个处理程序映射,引用了我删除的旧版ReportViewer。 (我也尝试添加一个新的处理程序映射 - 没有指定版本 - 但这不起作用所以我删除它。)

我按照The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both

尝试了qualifyAssembly web.config节点

根据MSBuild Using Wrong Version of Assembly to Compile RDLC File我尝试确定我的构建使用的VisualStudioVersion甚至编辑Microsoft.ReportingServices.targets(我把它恢复到原来的状态)。这是我头脑中的一部分,我不想搞砸任何东西。任何想法都会非常感激。

0 个答案:

没有答案
相关问题