更新源映射 [英] Updating source mappings

查看:19
本文介绍了更新源映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 TFS2018 api 将源映射从我的 XAML 构建定义复制到新的构建定义.我有以下代码

I am using the TFS2018 api to copy the source mappings from my XAML build definitions to the new build definition. I have the following code

var def = defs.FirstOrDefault(d => d.Name == xamlDef.Name);
if (def != null)
{
    var json = JsonConvert.SerializeObject(mappings);
    var tfvs = json.Replace("$(SourceDir)", "");       
    def.Repository.Properties["tfvcMapping"] = tfvs;
    using (var buildClient = new BuildHttpClient(uri, cred))
    {
        var t = buildClient.UpdateDefinitionAsync(def, teamProject);
        var result = t.Result;
    }
}

tfvs 变量包含以下字符串

The tfvs variable contains the following string

{"mappings":[{"serverPath":"$/Utils/TestQueue","mappingType":"map","localPath":"\Utils\TestQueue"},{"serverPath":"$/MyTeamProject/ProjectA","mappingType":"map","localPath":"\MyTeamProject\ProjectA"}]}

更新源映射后不存在.如果我查看构建定义,它只包含以下字符串

After I update the source mapping are not there. If I look at the build definition it only contains the following string

{[tfvcMapping, {"mappings":[{"serverPath":"$/MyTeamProject","mappingType":"map","localPath":"\\"}]}]}

tfvcMapping 字符串不正确吗?是否可能无法使用 tfs api 更新源映射?

Is the tfvcMapping string incorrect? Is it maybe not possible to update the source mappings using the tfs api?

推荐答案

当然你可以使用 tfs api 更新源映射,api 是 更新构建定义.

Of course you can update source mappings using the tfs api, the api is Update a build definition.

以下是源映射的JSON文件示例,您可以查看:

The following is an example of JSON file for source mapping, you can check it:

"tfvcMapping": "{\"mappings\":[{\"serverPath\":\"$/TestCase/TestCase1\",\"mappingType\":\"map\",\"localPath\":\"\\\\TestCase1\"},{\"serverPath\":\"$/TestCase/TestCaseProject\",\"mappingType\":\"map\",\"localPath\":\"\\\\TestCaseProject\"}]}"

这篇关于更新源映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆