简体   繁体   English

获取 XAML 构建定义中的详细步骤

[英]Getting detailed steps in a XAML build definition

I have this old project on a TFS 2017 build server that uses a XAML build definition.我在使用 XAML 构建定义的 TFS 2017 构建服务器上有这个旧项目。 I would like to get all the steps that build executes as it seems to build the solution and make some packages.我想获得构建执行的所有步骤,因为它似乎构建解决方案并制作一些包。

The TFS admin (not me) can't install any of the plugins, that allow you to export the build... so I'm trying via code TFS 管理员(不是我)无法安装任何允许您导出构建的插件...所以我正在尝试通过代码

I have the code below at the moment to get the basic info, but I need detailed step/task info so that I can setup a new build that does exactly the same.我现在有下面的代码来获取基本信息,但我需要详细的步骤/任务信息,以便我可以设置一个完全相同的新版本。 I can still access the xaml build defenition in VS, but that only says it builds the solution, no other steps.我仍然可以在 VS 中访问 xaml 构建定义,但这只是说它构建了解决方案,没有其他步骤。
I got the id of the definition by looping through all definitions for the project first, It doesn't have to be neat code as long I get what I need quick and dirty.我通过首先遍历项目的所有定义来获得定义的 id,只要我快速而肮脏地得到我需要的东西,它就不必是整洁的代码。

    TfsTeamProjectCollection ttpc2 = new TfsTeamProjectCollection(tfsurl);
    var buildClient = ttpc.GetClient<XamlBuildHttpClient>();
    var defs = buildClient.GetDefinitionsAsync(project: "PROJECT NAME").Result;

    var definition = defs.First(x => x.Id == 22);
    Console.WriteLine("uri: " + definition.Uri);
    Console.WriteLine("name: " + definition.Name);
    Console.WriteLine("id: " + definition.Id + " project id: " + definition.Project.Id);

btw the last build of this definition failed (due to the drop folder being unavailable) and it's also null in the definition I get in code.顺便说一句,此定义的最后一次构建失败(由于放置文件夹不可用),并且在我在代码中获得的定义中它也是 null。 I can still see all the previous builds on the server.我仍然可以在服务器上看到所有以前的构建。 I would have thought that lastbuild would contain either the last successful build or the latest build with a "failed" status or something.我原以为 lastbuild 将包含最后一次成功的构建或具有“失败”状态或其他内容的最新构建。

XAML build doesn't have tasks. XAML 构建没有任务。 It's Windows Workflow.这是 Windows 工作流程。 There's no way to get the "steps", because a XAML build process template is actually a program.没有办法获得“步骤”,因为 XAML 构建过程模板实际上是一个程序。 You could run the same build twice and get completely different behavior based on any number of factors.您可以运行相同的构建两次并根据任意数量的因素获得完全不同的行为。

If you're using an out-of-the-box build process template, you'll discover that the default JSON build/YAML build templates do more or less the same things.如果您使用的是开箱即用的构建过程模板,您会发现默认的 JSON 构建/YAML 构建模板或多或少地执行相同的操作。 If you have a custom build process template, you're going to have to open it up in a XAML editor and read through the code and replicate it as best you can.如果您有自定义构建过程模板,则必须在 XAML 编辑器中打开它并通读代码并尽可能复制它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM