How to start Team Foundation Build Service using Tfs API

Заблокировано How to start Team Foundation Build Service using Tfs API

  • 19 июня 2012 г. 9:43
     
      С кодом

    Hi,

    I have been striving hard to start The Team Foundation Build Service using the tfs api. The below code line runs the build service as Interactive process but I want to run it as a Windows Service

     typeof(BuildServiceHostUtilities).Assembly.GetType("Microsoft.TeamFoundation.Build.Config.BuildServiceHostProcess").InvokeMember("Start", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static, null, null, new object[] { true, null });

    Looking forward to hearing from you all soon. Thanks beforehand.

    -Noor

Все ответы

  • 19 июня 2012 г. 10:46
     
     

    Hi Noor,

    The build service is running as a windows service, called "Visual Studio Team Foundation Build Service Host" (service name: TFSBuildServiceHost). So I would not use the API, but something like described here: http://social.msdn.microsoft.com/Forums/en/netfxremoting/thread/bdbfd945-3941-4217-bb03-3e15375b80d9 .

    Cheers, Fokko


    ALM/TFS Consultant, Software Developer C#.NET, SQL Server specialist at Delta-N BV (http://www.delta-n.nl)

  • 19 июня 2012 г. 10:59
     
     Отвечено С кодом

    If its just a windows service can't you do this?

    var sc = new System.ServiceProcess.ServiceController("MyService", "MyRemoteMachine");
    sc.Start();
    sc.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Running);
    sc.Stop();
    sc.WaitForStatus(System.ServiceProcess.ServiceControllerStatus.Stopped);
    replace the "MyService" with the name of the service you intend to control and "MyRemoteMachine" with the name of the machine where this service sits. 


    Please remember to mark the replies as answers if they help.

    Tarun Arora

    Blog: http://geekswithblogs.net/TarunArora  Subscribe in a reader

    • Помечено в качестве ответа noor syed 20 июня 2012 г. 6:34
    •