Reputation: 2328
I'm specifying a label in the "Get Version" property of a TFS 2012 build definition:
Get Version: LMyLabel
However, if MyLabel doesn't exist, the build fails with this error message:
Exception Message: TF14064: Could not find label MyLabel@*. (type LabelNotFoundException)
How can I configure the build to default to the latest code if MyLabel doesn't exist?
Upvotes: 2
Views: 806
Reputation: 4787
You would have to customise the template.
Locate the Get Workspace Activity
Note that it's properties has the GetVersion Argument
Now add a Try Catch Activity, where the current Get Workspace Activity resides
Copy the original Get Workspace Activity to the Try.
Copy the Get Workspace Activity and place it in the catch, Set the catch to Exception
In the Properties of you Get Workspace Activity set the VersionOverride value to be blank.
This should now try and Donwload the source for a label you supply, if that label is not present then the catch should be hit and you should then download the latest code.
This was done on the fly and may need some minor tweeking!
Upvotes: 3