Domanda

I want to trigger a build from C# In the build I need to change the default BuildController. My code look like this:

IBuildRequest buildRequest = BuildDefinition.CreateBuildRequest();
if(changebuildcontroller)
{
    buildRequest.DropLocation = @"\\zzz.Domain.com\yyy$\TFS\Drop";
    buildRequest.BuildController =  **???**;
}
...
var queuedBuild = buildServer.QueueBuild(buildRequest);

Questions:

  1. I would like to know how to find a list of buildcontrollers.
  2. Any advice about how to understand the TFS object model will be appreciated. I looked at MSDN articles like this, but I do not see how it should help me. I used Google to find implementations of other objects in the Microsoft.TeamFoundation.Build.Client namespace.
È stato utile?

Soluzione

It helped looking at another assignment for a while :)

If anyone else run into the same problem Use the Ibuildserver object to get a list of IBuildController

buildServer = (IBuildServer)teamProjectCollection.GetService(typeof(IBuildServer));
IBuildController[] buildserverlist = buildServer.QueryBuildControllers();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top