When I want run the report viewer with Visual Studio, it cause the following error.
========================================================================= Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\\Windows\\assembly\\GAC_MSIL\\Microsoft.ReportViewer.WebForms\\10.0.0.0__b03f5f7f11d50a3a\\Microsoft.ReportViewer.WebForms.dll' and 'c:\\Windows\\assembly\\GAC_MSIL\\Microsoft.ReportViewer.WebForms\\11.0.0.0__89845dcd8080cc91\\Microsoft.ReportViewer.WebForms.DLL'
Source Error:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private global::Microsoft.Reporting.WebForms.ReportViewer @__BuildControlReportViewerSummary() {
global::Microsoft.Reporting.WebForms.ReportViewer @__ctrl;
Is that mean i missing the .dll file ???
Thank you.
The problem is totally unrelated to missing DLL file, instead it should related to same ReportViewer
namespace exists in different DLL files at same directory (%Windows%\\assembly). Try following solutions:
Check older version of ReportViewer
in _bin_deployableAssemblies
directory. Delete all files related to it, and use Microsoft.ReportViewer.11.0
references.
Check duplicate declarations of Microsoft.ReportViewer.WebForms
namespace in web.config file, remove older one if exists.
Add qualifyAssembly
element in web.config file:
<qualifyAssembly partialName="Microsoft.ReportViewer.WebForms" fullName="Microsoft.ReportViewer.WebForms,version=11.0.0.0,culture=neutral,publicKeyToken=89845dcd8080cc91" />
If the problem still persists, remove all references related to Microsoft.ReportViewer.WebForms
namespace, clean entire solution (deleting DLL files referenced to older version), add new references with latest version then rebuild the solution file. Also, you may trying remove/uninstall one of conflicted DLL files from assembly directory.
NB: Remember that both versions (10.0 & 11.0) have different PublicKeyToken
property value, hence bindingRedirect
trick in dependentAssembly
node doesn't work.
Related issues with CS0433:
The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.