我一直在谷歌搜索,找不到任何可靠的例子如何完成,或者甚至可以做到。我认为它可以。谁能指出我正确的方向?

到目前为止,我一直在寻找msdn上的TFS命名空间文档。我的目标是能够从Intranet 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客户端组件,但在MSDN上 http://msdn.microsoft的.com / EN-US /库/ cc339575.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top