像我们用的cctray,可以设置.NET Remoting的方式添加一个主机,然后获取服务器编译的结果并提供手工触发编译的功能。因为工作需要,我需要通过代码查询编译服务器当前的编译状况,获取一些CCNET服务器端的信息。因此,我也通过.NET Remoting方式,轻松的取得了想要的一些信息。

首先,需要添加引用:ThoughtWorks.CruiseControl.Remote.dll,了解.NET Remoting的应该知道这个DLL定义的是远程封送的对象接口。

然后,调用也很简单:

static void Main(string[] args)
{
    ICruiseManager manger 
= (ICruiseManager)RemotingServices.Connect(typeof(ICruiseManager),
        
"tcp://xxx.xxx.xxx.xxx:21234/CruiseManager.rem");

    ProjectStatus[] status 
= manger.GetProjectStatus();

    
foreach (var s in status)
    {
        
// 输出上次成功编译的标签号
        Console.WriteLine(s.LastSuccessfulBuildLabel);
    }
}

 

相关文章:

  • 2022-02-09
  • 2021-07-01
  • 2021-11-21
  • 2022-01-12
  • 2021-09-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-05-14
  • 2022-02-09
相关资源
相似解决方案