You can use the filePath type in a vNext VSTS/TFS task as shown below 

{  
     "name": "settingsFile",  
     "type": "filePath",  
     "label": "Settings File",  
     "defaultValue": "",  
     "required": false,  
     "helpMarkDown": "Path to single settings files to use (as opposed to files in project folders)",  
     "groupName":"advanced"  
   }  

to present a file picker dialog in the build editor that allows the build editor to pick a file or folder in the build’s source repository

image

While doing some task development recently I found that this control did not behave as I had expected

  • If a value is explicitally set then the full local path to selected file or folder (on the build agent) is returned e.g. c:agent_work3syourfolderyourfile.txt – just as expected
  • If you do not set a value, or set a value then remove your setting when you edit a build, then you don’t get an empty string, as I had expected. You get the path to the BUILD_SOURCESDIRECTORY e.g. c:agent_work3s – makes sense when you think about it.

So, if as in my case, you wanted to have specific behaviour only when this values was set to something other than the repo root you need to add some guard code

  
if ($settingsFile -eq $Env:BUILD\_SOURCESDIRECTORY )  
{  
    $settingsFile = ""  
}  

Once I did this my task behaved as a needed, only running the code when the user had set an explicit value for the settings file.