blog

Create a Build vNext build definition

Published on
9 minute read

I am going to show how to create a Build vNext build definition on VSO. Microsoft recently announced the creation of a brand new build system for TFS and VSO at the Connect event last year. This new build system will eventually replace the current one and be much more modular and friendly. Happily I am in the early adopter program and the product team just made an early alfa of the service available for that program and I have been giving it a spin.

Download Team Foundation Server 2015 today

Microsoft has released a CTP of TFS 2015 that includes the vNext build system. You can download TFS 2015  and try it out today. Remember that this is not a go-live version and you should not install it in production.

Now that we have configured a Build vNext agent  we can get on with the job of creating a build. I had hoped that for my demo at NDC London last month  that I would have been able to use this but it took an extra month for the product team to get the Alfa ready. This is really just part of the realities of software development that we can’t know how long something will take until its done.

Create a Build vNext build definition

There are a number of out-of-the-box templates available and I believe that there will be more by launch. For my FabirikamFiber site I will be using the standard “Visual Studio” definition.

Create a Build vNext build definition

You will get dropped out at Build tab of the “New Visual Studio definition 1” definition that has been created for you. Here you can add new tasks and configure them, which we will discuss in a moment.

Create a Build vNext build definition

This has not yet been saved, so the first thing I am going to do is save my detention with a little more memorable name.

Create a Build vNext build definition

Back at the “Task” list you can click “Add new task” to get a list of all of the available tasks. This is probably pretty close to the list of tasks that we will see initially when the preview becomes more generally available and it is extensive:

This is just the list that is available in the preview, which is alfa. The plan, as I currently understand it, is to make this extensible so that you can create any sort of tasks that you like and have them listed in the system. At the moment however there is no way to do this and I am not sure when this will happen.

Create a Build vNext build definition

The second tab is the “Options” tab. This is a list of general options that applicable to any build that you would run. Here we can select:

Create a Build vNext build definition

Currently the new Team Build vNext system only support Git as the source repository, but you can also select Github and point to any repository that you like. Although I have not tried it I believe that it will support any Git repository that uses the same protocols as GitHub. Nice…

Info: VSO Build vNext has built in support for GitHub builds

Create a Build vNext build definition

In addition to where to get the source code from you may need to create some custom variables that will be available as part of the build. These would be available in your scripts and any other location. There are some enforced variables and most are configurable.

You may use this to inject an option like “HardenPlatfrorm” that takes a Boolean option and you can then use that in your scripts and commands to choose wither you apply your application hardening techniques for piracy protection. Allows you to easily turn it off and on per build…

Create a Build vNext build definition

At the moment the only trigger available is “Continuous Integration” or CI. I would expect in the future to maintain the ability to Schedule builds as well and I really like the fact that you select it with a check-box rather than a radio-button. That bodes well for the future.

Create a Build vNext build definition

“General” configuration contains the last few nuggets of usefulness. First is the pre-defined default queue and maybe a description for the build. I am hoping that we can dynamically update the build number from within the tasks as this is what the majority of my customers want. It just makes sense, to me, to be able to have the build number reflect the version of the code that is being built.

For TFVC I normally change the build number to be something like “1.3.$(YY)$(DayofYear)$(rev:.r)” which would produce something like “1.3.15001.1” as the build number. I would then have a PowerShell that stripped that build number and used it for the DLL’s and the Nuget packages that are produced as part of the build. This works great when we have a single build definition per branch.

However, for Git we need something a little different. With Git builds we build all branches (potentially) with the same build definition. So here we want to have a file checked into the branch that has the filter above so that it can be different per branch. That means that the first thing that we need to do as part of the build is to have a PowerShell execute that reads that file and changes the build name in TFS to match. We will see if that is possible in the new build system as it was hard, but not impossible, in the old one.

Create a Build vNext build definition

Finally, a much requested feature. Most folks want to do a little bit of audit on their build configuration as from some reason folks go in there and change stuff. Now you will know not only who did the change but what they changed. Just above the entry is a little “Diff” button…

Create a Build vNext build definition

…Where you get a full diff of the configuration changes that were made between edits. This makes it really easy to see what was changed and the comment should give you an idea of why. Here you can see that I added a trigger of type 2 (CI).

Create a Build vNext build definition

You now have a build definition configured and you can queue a new build. You can see the Associated commits and other information coming in immediately and there is a new real-time (kinda) command window where it shows the status of the build as it executes.

Conclusion

All in all I am very impressed with the current system. My only issue, as you see the build failed above, is that I get a PowerShell version miss match during execution. This may be due to me using Windows Server Technical Preview as by build platform and I have reached out to the awesome build guys to find out what the issue is. In the mean time I will likely build out a Server 2012 R2 to do more testing…

install-and-configuration tools-and-techniques blog android build cmake jake msbuild powershell preview tf-build tfs tfs-2015 vnext visual-studio vsteamservices vstest xcode

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Freadom Logo
Healthgrades Logo
Slicedbread Logo
Brandes Investment Partners L.P. Logo
DFDS Logo
Boxit Document Solutions Logo
Trayport Logo
Akaditi Logo
Schlumberger Logo
Jack Links Logo
Xceptor - Process and Data Automation Logo
Microsoft Logo
Big Data for Humans Logo
Higher Education Statistics Agency Logo
Genus Breeding Ltd Logo
Flowmaster (a Mentor Graphics Company) Logo
SuperControl Logo
Slaughter and May Logo
Ghana Police Service Logo
Royal Air Force Logo
Washington Department of Transport Logo
Washington Department of Enterprise Services Logo
Department of Work and Pensions (UK) Logo
New Hampshire Supreme Court Logo
ALS Life Sciences Logo
Graham & Brown Logo
Jack Links Logo
Schlumberger Logo
Brandes Investment Partners L.P. Logo
Big Data for Humans Logo