ASP.NET网站CS0433 ReportViewer存在xx和xx错误

问题描述 投票:0回答:1

我正在努力解决我在我继承的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中有assembly和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个回答
0
投票

弄清楚了! bindingRedirect旧版本需要包含版本10,新版本需要为8

<bindingRedirect oldVersion="8.0.0.0-10.0.0.0" newVersion="8.0.0.0"/>
© www.soinside.com 2019 - 2024. All rights reserved.