如何确定以前TFS Build期间使用的自定义参数和值?

时间:2015-09-17 16:05:38

标签: visual-studio tfs2013

如何确定TFS构建期间使用的自定义参数值?

1 个答案:

答案 0 :(得分:1)

您可以通过使用TFS API实现此目的,请检查以下代码:

TfsTeamProjectCollection tfctc = new TfsTeamProjectCollection(new Uri("http://tfsservername:8080/tfs/DefaultCollection"));
        IBuildServer bs = tfctc.GetService<IBuildServer>();

        IBuildDetail[] builds = bs.QueryBuilds("teamprojectname", "builddefinitionname");
        foreach (var build in builds)
        {
            var buildefinition = build.BuildDefinition;
            IDictionary<String, Object> paramValues = WorkflowHelpers.DeserializeProcessParameters(buildefinition.ProcessParameters);
            string processParametersValue = paramValues["argument1"].ToString();
            Console.WriteLine(processParametersValue);
        }