Leon Mayne

Having a bit of a problem with practically the only example on the web I could find for starting a build programmatically. I've added references to these DLLs in my project:

Microsoft.TeamFoundation.Build.Client

Microsoft.TeamFoundation.Build.Common

Microsoft.TeamFoundation.Client

(as well as others)

And added the below imports:

using Microsoft.TeamFoundation.Client;

using Proxy = Microsoft.TeamFoundation.Build.Proxy;

using Microsoft.TeamFoundation.Build.Common;

But the below lines give compile errors:

Proxy.BuildController buildCtrl = Proxy.BuildProxyUtilities.GetBuildControllerProxy(TeamFoundationServerUrl);

Proxy.BuildStore store = Proxy.BuildProxyUtilities.GetBuildStoreProxy(TeamFoundationServerUrl);

The errors are:

'Microsoft.TeamFoundation.Build.Proxy.BuildProxyUtilities' does not contain a definition for 'GetBuildControllerProxy'

'Microsoft.TeamFoundation.Build.Proxy.BuildProxyUtilities' does not contain a definition for 'GetBuildStoreProxy'

I must be missing something simple. Can anyone help



Re: Team Foundation Server - Build Automation Microsoft.TeamFoundation.Build.Proxy

Madhuri Gummalla - MSFT

Hi Leon,

I haven't tried the implementation you are using but I do this to get the BuildController and BuildStore handles:

using Microsoft.TeamFoundation.Build.Proxy;

using Common = Microsoft.TeamFoundation.Build.Common;

using Microsoft.TeamFoundation.Proxy;

using Microsoft.TeamFoundation.Client;

TeamFoundationServer TFS = TeamFoundationServerFactory.GetServer(tfsUrl);

BuildStore buildStore = (BuildStore)(TFS.GetService(typeof(BuildStore)));

BuildController buildController = (BuildController)(TFS.GetService(typeof(BuildController)));

Thanks,

Madhuri





Re: Team Foundation Server - Build Automation Microsoft.TeamFoundation.Build.Proxy

Leon Mayne

Hello,

Yes, I realised while I was out that the code I was looking at was probably beta code. Sure enough, I switched to using GetService for each of the types and it worked fine.

Thanks for the quick reply.