1

I've defined an MSBuild activity in a TFS Workflow template, but currently I have to hard code the 'property' command line arguments directly into the template.

I'd like to be able to specify the arguments in the build definition, via the advanced setting, 'MSBuild Arguments'

I can see that I may have to build up the command line with string replace/concat, as mentioned here, but I can't see what I need to put, maybe something like this:

"/P:MyProperty=" + BuildDetail.Properteis("MyProperty")

Community
  • 1
  • 1
Dog Ears
  • 9,637
  • 5
  • 37
  • 54

1 Answers1

3

This is what the default MsBuild task uses:

String.Format("/p:SkipInvalidConfigurations=true {0}", MSBuildArguments)

You can change the MSBuildArguments variable in the build process template in multiple steps. For example, I added a Run Architecture Validation property to the process template and then edited the workflow to simply append /ValidateArchitecture=true to the MSBuildArguments before they're being passed to the MsBuild activity.

 <If Condition="[PerformArchitectureValidation]" DisplayName="Configure Architecture Validation MSBuild Arguments">
  <If.Then>
   <Assign>
    <Assign.To>
     <OutArgument x:TypeArguments="x:String">[MSBuildArguments]</OutArgument>
    </Assign.To>
    <Assign.Value>
      <InArgument x:TypeArguments="x:String">[MSBuildArguments + " /p:ValidateArchitecture=true"]</InArgument>
    </Assign.Value>
   </Assign>
  </If.Then>
 </If>

The PerformArchitectureValidation variable is defined as a Property on the Build Process Template level of type Boolean.


Update: Wrote a blogpost that explains this with steps and screenshots

jessehouwing
  • 106,458
  • 22
  • 256
  • 341