Set up a C# 6 / .NET 4.6 Build Agent for Atlassian Bamboo

Setting up a Remote Build Agent for Bamboo to build your C# code is pretty easy, although it may not be totally clear at first. The main thing to account for is that your code will be built directly using MSBuild rather than Visual Studio. So before you even get Bamboo involved, it is a good idea to just install everything needed for a successful build using MSBuild.

In order to do that, we need to download and install the following:

Installing the Build Tools

The latest .NET 4.6 Developer Pack

This includes the .NET Framework, SDK, and Targeting Packs. As with all .NET 4 previous Framework installations, this replaces any existing .NET 4 installations and exists alongside any pre-.NET 4 installations.

Microsoft Build Tools 2015

This includes MSBuild 14, which you will need to build any Visual Studio 2015 projects. It is also backwards compatible with older Visual Studio projects.


As you may have gathered, this will let you rebuild your Nuget references. You need to put this somewhere in the System Path. It’s probably a good idea to have just one folder to all executable files (like nuget.exe) that don’t come with an installer, and don’t need other DLLs. You can add that folder to the system path. I keep these in c:\usr\bin.

Git for Windows

… or a client for whichever SCM you are using.

After you’re done installing the above, you should check-out your code and try building it using MSBuild. You may encounter some errors, as Microsoft Build Tools 2015 will not include many of the assemblies that are included with Visual Studio and referenced by the Project Templates. You would need to add Nuget references for any assemblies that are causing build errors.

Installing the Build Agent

Once you have a successful build, you can proceed installing the Bamboo Build Agent (and Java):

  • Java SE Development Kit 8
  • Bamboo Build Agent: https://{your_subdomain}

Java SE Development Kit 8

The Build Agent is a Java JAR application, and it requires Java 8.

Bamboo Build Agent

You can download the Build Agent JAR from the Build Agent configuration screen in your Bamboo Portal. You can get the direct URL for this screen by replacing the {your_subdomain} portion of the Bamboo Build Agent link above with your sub-domain. Or just follow these screen shots:

Settings -> Agents …


Install remote agent …


For a typical build agent, you want to have the JAR run as a Windows Service. For that you can get the JAR with a service wrapper by clicking the big ‘download’ button in the middle of that page. If you don’t want to run the JAR as a Windows Service, you can use the download link at the bottom of that page. We won’t cover that scenario here though.

Once you have downloaded the JAR file, open a command prompt as Administarator, and CD into the folder containing the JAR. Then you need to copy and paste the Java command in the Running a remote agent section into the command prompt, but DO NOT RUN IT AS IS. You need to run it with an Install parameter, which should look like the following

java  -jar atlassian-bamboo-agent-installer-{version}.jar  https://{your_subdomain}  -t {security_token}  install

This will install the Bamboo Build Agent files in the %USERPROFILE%\bamboo-agent-home\ path. You need to go into %USERPROFILE%\bamboo-agent-home\bin\ and run the InstallBambooAgent-NT.bat as administrator. This will install the Windows Service, which you can confirm by going into services.msc as shown below.
Bamboo Build Agent Windows Service

Once you start the service, it will register itself with your Bamboo Build Server. You will need to go into the Agents Configuration on your Bamboo Portal and Approve access for this agent before you can use it.

Bamboo Agent Allow-Access

If you already have other Build Agents registered, you will need enough free Build Agent licenses to be able to approve access to it. If you do not have enough licenses, you will need to revoke access for another Build Agent, before you can Approve this one.

Once You’ve approved the Build Agent, you can use it in your Build Plans. Bamboo will automatically detect the MSBuild version you installed on the server, and let you pick that version in the Build Task in your plan. To get the code to compile you will need to add a Script Task to run before the Build Task. The script body should be as follows:

nuget restore {your-solution-filename}.sln

After setting that up, your .NET Project should be successfully building on your new Build Agent.

You can find more information about Remote Build Agents for Bamboo such as licensing requirements etc on the Bamboo website

Adding click handler for RecyclerView List Entries

If you’re migrating from the ListView to RecyclerView in API Level 21 support library (i.e. Android 5.0 / Lollipop), you may be wondering how to add a click listener for entries in the list. With the ListView you would provide a single listener for all list entries using the ListView.setOnItemClickListener() method, which takes an implementation of the AdapterView.OnItemClickListener interface as its parameter. In your implementation of this interface you would override the onItemClick() method where you are given the ListView instance, the View for the entry in the list, its position, and ID as method parameters.

The stumbling block with the RecyclerView is that it does not have this setOnItemClickListener() method. The solution is actually quite simple, you can use the standard setOnClickListener() method provided by the View object. You can do this for the View objects corresponding to each list entry.

You would typically inflate the required View object from the respective resource definition in your override of the RecyclerView.Adapter.onCreateViewHolder() method. You would also construct your version of the RecyclerView.ViewHolder class there and pass the inflated View object as a constructor parameter.

The View.setOnClickListener() accepts a View.OnClickListener implementation as its parameter, and your ViewHolder is a good place to implement this. This is because the ViewHolder class has access to the list entry View object, its parent, position, and ID which are exactly the same as the parameters you were provided in the old ListView onItemClick() method.

Your ViewHolder class could look something like the following:

public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
    protected ViewHolder(View v)
        // Inflate all your UI elements for the list entry ..
        // and ...

    public void onClick(View v)
        int pos = this.getPosition();
        long id = this.getItemId();
        ViewParent parent = v.getParent();

And that’s really it! The code above should provide a good start for your ViewHolder class. Hopefully this has been helpful.