2014-09-05 63 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