2011-11-17 69 views
3

我正在爲c#開發Excel的實時數據服務器。
一切都很好,直到我 開始 嘗試使用從組件B到XL服務器(XLS)的類。
當我在代碼「XLS」類(程序集A)中實例化「MyClass」(程序集B)並部署/註冊該DLL時,從Excel應用程序調用「XLS」將導致#N/A(即「東西」出錯).Net程序集註冊和依賴項問題

因此,問題:如何通過RegAsm將其通過RegAsm進行部署以將其作爲DLL用於Excel時,將程序集B中的實例用於程序集A中?

Architecture

public class XLS : Excel.IRtdServer 
{ 

private MyClass MCHammer; 
public int ServerStart(Excel.IRTDUpdateEvent cb) 
{ 
     try 
     {     
      int i = 0; 

      // When the following line is commented, the next one results in divide-by-zero exception (ok). 
      // but when left effective, I only get "#N/A" on Excel. So my guess is that this is blowing BEFORE Runtime. 
      MCHammer = new MyClass(); 

      i = i/i; //Assert-line : Should blow divide-by-zero exception if executed 

      // This message is dropped to Excel for display 
      // When divide-by-zero line is commented AND NO instantiation of MyClass is made, 
      // This message is displayed in Excel (ie everything went fine) 
      XL_MESSAGE = "ALL COOL"; 
     } 

     catch (Exception ex) 
     { 
      // This is dropped to excel for display when catch block is entered 
      // Only happens when "new MyClass()" line is commented 
      XL_MESSAGE = "EXCEPTION : " + ex.ToString(); 
     } 
    } 
} 

回答

1

我想通了大會B爲64位,而大會一疊86。
所以Excel中一度下探一種無形的「目標調用異常」(格式等)的罩後面
這個上

更多信息(我使用COM調用模擬與C#程序樣本調試東西)我的其他相關問題herehere