0

我正在使用引用使用Microsoft企業庫版本5的程序集的MVC3應用程序。在ASP.NET 3.5中使用ScriptManager ASPX頁面和EnterpriseLibary 5.0

我正在做一個關於使用ReportViewer創建報告的研究項目。我瞭解到ReportViewer不能在Razor視圖中使用,所以我必須使用ASPX頁面。該頁面如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Test.BirthdayReport.BirthdayReport" %> 

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml"> 
    <head runat="server"> 
     <title>Birthday Report</title> 
    </head> 
    <body> 
     <form id="form1" runat="server"> 
     <div> 
      <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
      <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="100%">      </rsweb:ReportViewer> 
     </div> 
     </form> 
    </body> 
</html> 

爲了使用的ReportViewer,我必須包括ScriptManager的,但在頁面加載時我收到此錯誤:

Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

我知道我不能要在bin目錄中都是4.0和5.0 EnterpriseLibrary程序集,所以我嘗試在項目中添加對Microsoft.Practices.EnterpriseLibrary.Common 5.0版本的引用,但我仍然得到相同的錯誤。

如何在EnterpriseLibary 5.0中使用ScriptManager?

回答

0

我們的另一個程序集(用於Web應用程序)引用了EnterpriseLibrary.Common 5,EnterpriseLibrary.Logging 5,EnterpriseLibrary.Data 4.1和EnterpriseLibrary.Logging.Database 4.1。

一旦我確定此程序集引用所有這些程序集的5.0版本,我的錯誤就停止了。

+0

您是如何找出哪一個引用EnterpriseLibrary 4.1的?我有同樣的問題,但沒有一直髮生,所以我無法捕捉到問題所在。 – Gil

+0

我們在解決方案中有幾個項目,我只是檢查了每個項目的參考資料並找到它。 –

相關問題