【问题标题】:ASP.NET web site CS0433 ReportViewer exists in both xx and xx errorASP.NET 网站 CS0433 ReportViewer 同时存在 xx 和 xx 错误
【发布时间】:2018-08-08 22:16:17
【问题描述】:

我正在努力解决我在继承的 ASP.NET 网站项目中遇到的错误。

Error   CS0433  
The type 'ReportViewer' exists in both 
'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 
'Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

我们在 web.config 中有程序集和 buildProvider 引用

<assemblies>
   ...
   <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
   <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
   <add assembly="Microsoft.ReportViewer.ProcessingObjectModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
   ...
</assemblies>
<buildProviders>
   <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</buildProviders>

还有httpHandler

<httpHandlers>
   ...
   <add verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
   ...
<httpHandlers>

还有运行时参考。我什至尝试将 newVersion 设置为 8.0.0.0,但这也无济于事

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Microsoft.ReportViewer.WebForms" publicKeyToken="b03f5f7f11d50a3a"/>
    <bindingRedirect oldVersion="8.0.0.0" newVersion="10.0.0.0"/>
  </dependentAssembly>
</assemblyBinding>    
</runtime>

非常感谢我可能尝试的任何建议

【问题讨论】:

    标签: asp.net reportviewer gac report-viewer2010


    【解决方案1】:

    想通了! bindingRedirect 旧版本需要包含版本 10,新版本需要是 8

    <bindingRedirect oldVersion="8.0.0.0-10.0.0.0" newVersion="8.0.0.0"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-25
      • 1970-01-01
      • 1970-01-01
      • 2016-01-31
      相关资源
      最近更新 更多