I am using TFS 2018 on premise with a TFVC project. When I create a new build using the “Empty process” template, the “Get sources” task is automatically added as the first step. This task always gets the latest sources by specifying the latest changeset number on the command line at run time: “tf vc get /version:{latest changeset number}”. I know that the agent variable “Build.SourceVersion” is available and contains the value of the {latest changeset number}. I also know that when I queue the build I can specify the "Build.SourceVersion” for the “Get sources” task in the “Source version” field.
How can I specify the “Source version” in the build definition?
How can I override the "Build.SourceVersion” variable used by the “Get sources” task?
I have tried to specify the "Build.SourceVersion” variable on the “Variables” tab of the build definition but it appears to have no effect.
Update: I created a User Voice request for this: https://visualstudio.uservoice.com/forums/330519-visual-studio-team-services/suggestions/32746480-allow-source-version-to-be-specified-in-the-get