簡體   English   中英

SSRS-報表查看器編譯錯誤

[英]SSRS - Report Viewer Compilation Error

當我想使用Visual Studio運行報表查看器時,它會導致以下錯誤。

================================================== =======================編譯錯誤

說明:編譯服務於此請求所需的資源期間發生錯誤。 請查看以下特定的錯誤詳細信息,並適當地修改您的源代碼。

編譯器錯誤消息:CS0433:類型'Microsoft.Reporting.WebForms.ReportViewer'同時存在於'c:\\ Windows \\ assembly \\ GAC_MSIL \\ Microsoft.ReportViewer.WebForms \\ 10.0.0.0__b03f5f7f11d50a3a \\ Microsoft.ReportViewer.WebForms.dll和'c:\\ Windows \\ assembly \\ GAC_MSIL \\ Microsoft.ReportViewer.WebForms \\ 11.0.0.0__89845dcd8080cc91 \\ Microsoft.ReportViewer.WebForms.DLL'

源錯誤:

[System.Diagnostics.DebuggerNonUserCodeAttribute()]
       private global::Microsoft.Reporting.WebForms.ReportViewer @__BuildControlReportViewerSummary() {
          global::Microsoft.Reporting.WebForms.ReportViewer @__ctrl;

這是否意味着我缺少.dll文件???

謝謝。

該問題與缺少DLL文件完全無關,相反,它應該與同一目錄(%Windows%\\ assembly)的不同DLL文件中存在的相同ReportViewer命名空間有關。 嘗試以下解決方案:

  1. _bin_deployableAssemblies目錄中檢查ReportViewer較舊版本。 刪除與此有關的所有文件,並使用Microsoft.ReportViewer.11.0引用。

  2. 檢查web.config文件中Microsoft.ReportViewer.WebForms命名空間的重復聲明,如果存在則刪除較舊的聲明。

  3. 在web.config文件中添加qualifyAssembly元素:

     <qualifyAssembly partialName="Microsoft.ReportViewer.WebForms" fullName="Microsoft.ReportViewer.WebForms,version=11.0.0.0,culture=neutral,publicKeyToken=89845dcd8080cc91" /> 
  4. 如果問題仍然存在,請刪除與Microsoft.ReportViewer.WebForms命名空間相關的所有引用,清理整個解決方案(刪除引用到較早版本的DLL文件),添加具有最新版本的新引用,然后重新生成解決方案文件。 另外,您可以嘗試從程序集目錄中刪除/卸載沖突的DLL文件之一。

注意:請記住,兩個版本(10.0和11.0)具有不同的PublicKeyToken屬性值,因此, dependentAssembly節點中的bindingRedirect技巧不起作用。

CS0433的相關問題:

C#:類型“ Microsoft.Reporting.WebForms.ReportViewer”同時存在於ReportingServicesWebUserInterface.dll和Microsoft.ReportViewer.WebForms.dll中

兩者中都存在類型'Microsoft.Reporting.WebForms.ReportViewer'

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM