使用构建配置的TFS工作流If语句 [英] TFS Workflow If Statement using Build Configuration

查看:90
本文介绍了使用构建配置的TFS工作流If语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用与TFS 2012配对的Visual Studio2012.现在,我正在构建自定义工作流模板,需要运行if语句来分隔两个invokeprocess. if语句的条件需要在我正在运行的哪个构建配置下运行,我希望它像下面的C代码一样运行:

I am working with Visual Studio 2012 paired with TFS 2012. Right now I am building a custom workflow template and need to run an if statement to separate two invokeprocess's. The condition for the if statement needs to operate off of which build configuration I am running, I want it to operate like this C code:

if(Configuration == 'Debug')
{//run for debug}
else if(Configuration == 'Release')
{//run for release}

我的问题是,我找不到关于如何在工作流程中创建条件的任何文档或帮助,以及如何在该条件中使用构建配置作为值.希望有人提出一些直截了当的问题,如果需要任何澄清,请告诉我!谢谢!

My problem is that I can't find any documentation or help as to how one would go about creating a conditional in workflow, and how I can use my build configuration as a value in this conditional. Hopefully a straight-forward question that someone has some insight on, if any clarification is needed please let me know! Thanks!

推荐答案

要回答有关工作流中"if"的基本问题,请在设计器中打开worflow xaml文件.转到查看>工具箱.在控制流"标题下有一个如果"活动,您可以将其拖放到工作流中.

To answer your basic question about an "if" in a workflow, open the worflow xaml file in the designer. Go to View > Toolbox. Under the heading "Control Flow" there is an "If" activity that you can drag and drop into your workflow.

一个工作流程可以有多个项目和以多种配置构建的解决方案.工作流包含一个名为BuildSettings的参数,该参数具有一个称为PlatformConfigurations的属性.默认模板将按编译和测试"顺序遍历所有项目的所有PlatformConfigurations.您可能只想在该循环中获取platformConfiguration变量并获取Configuration,然后将if放置在MSBuild活动之前或之后,或者您可能需要针对要执行的特定项目使用其他逻辑.

A workflow can have multiple projects and solution being built in multiple configurations. The workflow contains an argument, BuildSettings, which has a property called PlatformConfigurations. The default template will loop through all PlatformConfigurations for all projects in the "Compile and Test" sequence. You may just want to grab the platformConfiguration variable in that loop and get the Configuration and put the if either before or after the MSBuild activity or you may need additional logic for specific project you want to act on.

这篇关于使用构建配置的TFS工作流If语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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