2014-09-05 24 views
2

您好,我正在嘗試將compile我的C#代碼轉換爲要用於VBA script中的客戶端的.dll文件。使用SOAP Web引用將C#類編譯爲.dll錯誤CS0234

我的C#代碼引用了一個SOAP Web服務,表現不佳。當我運行csc /target:library file.cs時,我在COM和CS0246 BbsSecurityContext,BbsEntityResult(web服務中的類)上收到以下錯誤CS0234。它說名稱空間SOAPTest中不存在com名稱空間。請讓我知道我是否可以提供更多信息。

下面是代碼文件

... 
using SOAPTest.com.blueberryhosting.broadviewbbsvcstg; 
using System.Runtime.InteropServices; 

namespace SOAPTest 
{ 
    [Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E")] 
    [ClassInterface(ClassInterfaceType.AutoDual)] 
    public class Webservice 
    { 
     private BbsSecurityContext sc; 

     public Webservice(string apiKey, string sourceSystem, int userID) 
     { 
      createSecurityContext(apiKey, sourceSystem, userID); 
     } 
... 
public void getInvestors(string filepath) 
{ 
    using (BbsInteropWebService ws = new BbsInteropWebService()) 
    { 
      BbsEntityResult x = ws.GetInvestors(sc); 
      if(x.Success) 
      { 
      generateCSV(x,filepath); 
      } 
    } 
} 
... 

回答

1

您的片段包括using SOAPTest.com.blueberryhosting.broadviewbbsvcstg;片段。我懷疑你收到錯誤,因爲你指定的csc.exe命令只包含file.cs,並且該文件中沒有定義該命名空間。它很可能是在另一個代碼文件或庫中定義的。您需要在調用編譯器時提供所有依賴項。

Command-line Building With csc.exe

How to use references when compiling c# code via command line

+0

哇感謝你回答這個問題賽斯!週三我回去工作時,我會研究這一點。 – 2014-10-20 04:19:03