A build agent is what takes care of actually running a build definition. Agents can be installed on machines separate from the TFS server, allowing workload distribution.
The simple way to understand an agent is to imagine how you'd create continuous integration yourself.
You'd have a machine that could build the software. That means you'd have to install anything needed to accomplish the build, such as Visual Studio, 3rd party controls, certificates, tools, etc.
You'd write a script that could automate the build and report errors.
You'd create a way of running that script on demand, such as developing a Windows service.
That's all TFS Build is doing. You configure the steps (the build script) on the TFS server as a build definition. You install an agent on a machine that can check out the source code and successfully build the application. TFS calls the agent on demand.
It was unclear to me if I needed a licensed version of Visual Studio, or VS installed at all. The answers are:
- If you're not using the Visual Studio build step, and only the MS Build step, you might be able to get away with installing the 2015 Build Tools.
- However, you'll probably need Visual Studio installed. It does not need to be licensed, assuming it's not also being used for development.
Using Visual Studio on the Build Server: If you have one or more licensed users of Visual Studio Enterprise with MSDN, Visual Studio Professional with MSDN, or any Visual Studio cloud subscription then you may also install the Visual Studio software as part of Team Foundation Server 2017 Build Services. This way, you do not need to purchase a Visual Studio license to cover the running of Visual Studio on the build server for each person whose actions initiate a build.
Installing an agent is pretty simple. Really, just read Ben Day's post and you'll find out what you need. It's slightly outdated, but close enough. I've also listed the steps, below.
- Install everything needed to build the software. It's best to do this first.
- Download the agent from the TFS web. Manage Server (click the right corner gear) > click link "View collection administration page" > open Agent Queues tab > click "Download agent"
- Extract the zip into C:\TfsData\Agents[agent name]
- Run ConfigureAgent.cmd
- Mostly accept the defaults. The TFS server URL will be something like http://servername:8080/tfs. Answer Y to installing as a service.
After installation, you should see the agent in the Agent Queues.
If you're using a local TFS installation, the agent version is tied to the TFS version. If you update TFS, be sure to update the agents. It's easy. In Agent Queues, right-click the queue and choose Update All Agents.
Adding Agent Capabilities
Normally, all you need to do is install the software with the capability, then restart the agent. However, here are a couple of articles related to capabilities.
The Wrap Up
Agents are just services that run build steps. An agent can be installed on almost any machine, letting you easily configure your build environment.