2

I have created a visual studio online account and created a team project. Everything is working fine. I can access the team project without errors. I have created a build definition using the Hosted Build controller and hosted build agent.

In tbe build definition the Build Number format is:

"$(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)"

which is the default.

My requirement is that I need to include changeset number in Build Number Format. But I don't know how to do it.

I have also read this stack overflow question

but this did not help me.

Community
  • 1
  • 1
VishwajeetMCA
  • 139
  • 2
  • 12
  • You cannot using built-in features, you have to customize your build process as explained in the answers you link. So edit your question describing which kind of customization you favor and why the answers you find do not help you. – Giulio Vian Sep 22 '15 at 06:40
  • Thanks for reply. I followed above link. But getting error in "RunProcess" saying missing assembly reference. I searched for adding reference for RunProcess but could not find it. – VishwajeetMCA Sep 22 '15 at 09:45
  • I am getting errors at these two lines of code var process = new RunProcess(); var result = process.ExecuteCommand(TfsCommand, TfsArgument); – VishwajeetMCA Sep 22 '15 at 09:46
  • Please move your comments back to the question. RunProcess is, 99%, an helper class based on Process class (https://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx); read them as pseudo-code and write your own code to launch a sub-process, wait for its end and collect its output. – Giulio Vian Sep 22 '15 at 13:08

1 Answers1

2

An easier way for you to include changeset number into build number is to customize the UpdateBuildNumber activity in the build process template.

Please follow the steps below:

  1. Open the build process template you're using, and find out the Update Build Number build activity.
  2. Set the BuildNumberFormat to be

    String.Format("$(BuildDefinitionName)_$(Date:yyyyMMdd)_{0}$(Rev:.r)", BuildDetail.SourceGetVersion)

enter image description here

  1. Check in the build process template.
  2. Select to use that build process template in the build definition. And set empty value for Build Number Format property. See:

enter image description here

Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22
  • 1
    Thanks a lot Vicky for your working example. The steps you have mentioned are very clear and its working fine. I have implemented all the steps in build process template and saved the template and checked in the new (edited build process template) and then triggered a new build(Queue new Build). Build succeeded and the build format was like New Build Definition 1_20150923_C128.1 - Succeeded . Thanks – VishwajeetMCA Sep 23 '15 at 09:01