Ask a questionAsk a question
 

Answerpassing arguments to a custom task

  • Wednesday, November 04, 2009 5:24 PMtribal Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi Guys,

    Im using TFSBuild 2008. When queing a new build (using visual studio 2008 via Team Explorer) there is a text box at the bottom of the "Queue Build" dialog with the label:

    "MSBuild command-line arguments (optional):

    I need to pass in arguments via this box to my custom task written in C#, I know that there is a way to do this by modifying the rsp file, but I dont want to checkin/checkout on it, Is this possible..?

    Thanks in advance

Answers

  • Wednesday, November 04, 2009 7:43 PMOsirisJakob Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi tribal,

    If you just want to pass in the properties to your build task, you can just use the $() syntax to get the value of the properties when calling your task:

    <MyCustomTask SomeProperty="$(MyProperty)"/>

    So if you pass in a the MyProperty in the QueueBuild dialog, using the /p:MyProperty=xxx syntax, the value of the argument will be passed to your task.

    /Jakob
    Blog: http://geekswithblogs.net/jakob Twitter: http://twitter.com/osirisjakob
    • Marked As Answer bytribal Thursday, November 05, 2009 11:50 AM
    •  

All Replies

  • Wednesday, November 04, 2009 7:43 PMOsirisJakob Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Hi tribal,

    If you just want to pass in the properties to your build task, you can just use the $() syntax to get the value of the properties when calling your task:

    <MyCustomTask SomeProperty="$(MyProperty)"/>

    So if you pass in a the MyProperty in the QueueBuild dialog, using the /p:MyProperty=xxx syntax, the value of the argument will be passed to your task.

    /Jakob
    Blog: http://geekswithblogs.net/jakob Twitter: http://twitter.com/osirisjakob
    • Marked As Answer bytribal Thursday, November 05, 2009 11:50 AM
    •