TFS SDKを使用してビルドを作成、キューイング、および追跡できますか?

StackOverflow https://stackoverflow.com/questions/611485

  •  03-07-2019
  •  | 
  •  

質問

私はグーグル検索を行ってきましたが、これがどのように行われるのか、それができるのかさえ、具体的な例を見つけることができません。できると思います。誰かが私を正しい方向に向けることができますか?

これまでのところ、msdnのTFS名前空間のドキュメントを参照してきました。私の目標は、イントラネットWebアプリケーションからTFSのビルドを完全に自動化および追跡できるようにすることです。

役に立ちましたか?

解決

リチャードは正しい方向を教えてくれたので、見つけたもので自分の質問に答えます。

はい、TFS SDKを使用してビルドを作成、キュー、および追跡できます。必要なインターフェイス/クラスは、Microsoft.TeamFoundation.Build.Client名前空間にあります。 IBuildServer、IBuildDefinition、およびIBuildDetailは特に便利です。

TFS 2010の更新:TFS 2010 SDKを使用したプログラム例は、こちら

using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Build.Workflow;
using Microsoft.TeamFoundation.Client;

namespace ManageBuildTemplates
{
    class Program
    {
        static void Main(string[] args)
        {
            TfsTeamProjectCollection collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://jpricket-test:8080/tfs/collection0"));
            IBuildServer buildServer = collection.GetService<IBuildServer>();

            IBuildDefinition definition = buildServer.GetBuildDefinition("UnitTests", "Definition1");

            IBuildRequest request = definition.CreateBuildRequest();
            request.ProcessParameters = UpdateVerbosity(request.ProcessParameters, BuildVerbosity.Diagnostic);

            buildServer.QueueBuild(request);
        }

        private static string UpdateVerbosity(string processParameters, BuildVerbosity buildVerbosity)
        {
            IDictionary<String, Object> paramValues = WorkflowHelpers.DeserializeProcessParameters(processParameters);
            paramValues[ProcessParameterMetadata.StandardParameterNames.Verbosity] = buildVerbosity;
            return WorkflowHelpers.SerializeProcessParameters(paramValues);
        }
    }
}

他のヒント

tfsbuild.exe(VSインストールの... / Common9 / IDEフォルダー内)を確認します。

これは、アセンブリ Microsoft.TeamFoundation.Build.Client および Microsoft.TeamFoundation.Build.Common を参照します。これらは、ドキュメント化されていない名前空間を含んでいます。他のTFS cientアセンブリですが、MSDNにある http://msdn.microsoft .com / en-us / library / cc339575.aspx

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top