问题
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!
回答1:
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.
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.
来源:https://stackoverflow.com/questions/16968405/tfs-workflow-if-statement-using-build-configuration