No agent could be found with the following capabilities

In TFS 2015 / VSTS new build system each task contains a series of requirements that needs to be matched by agents capabilities for the task to run. Usually you install Visual Studio in the machine with the build agent and you can schedule standard .NET builds without problem, but what happens when the build starts to evolve?

When you start creating more complex build, you can find that your agent does not meets requirements because it miss some of the required capabilities. As an example, in TFS 2015 Build I’ve added task to run Sonar Qube Analysis on my code.

Build definition with Sonar Qube analysis enabled

Figure 1: A build with SonarQube analysis enabled

Now if I queue a build manually, TFS warned me that it is not able to find a suitable agent, and if you ignore that warning and queue the build here is the result.

The build failed because no agent with required capabilities was found in the pool.

Figure 2: Build failed because no suitable agent was find

The build failed because there are no agent capable to run it. Now you should go to the Project Collection administration page and verify all the agents.

Thanks to Capabilities tab in the administration page I can see a complete list of all agent capability.

figure 3: View agents capabilities in administration page

From that picture I verified that the only agent I’ve configured missed the Java capability, so I simply remote desktop to the server, installed java on the machine and then restart the agent service (VSO-Agemt-TFS2013Preview). After agent is restarted the build rans just fine.

Thanks to the new build system, TFS Build Agents can automatically determines some known capabilities (such as Java installed) and this is atuomatically matched with all the requirements that are contained in tasks you use in the build, so TFS can choose to run the build only in the agent that satisfies requirements, and if no agent is found it warns you with a clear error.

Gian Maria.

Uploading custom Build Task to TFS 2015

In a previous article I wrote on how to write a custom Task For Visual Studio Team Services, but a usual question is: can I use the same technique to write a task to TFS 2015 on-premise?

The answer is yes, and it is really simple, thanks to this fantastic article by Jesse, that explain how to use Fiddler to being able to authenticate to on-premise TFS without the hassle of enabling basic authentication. Thanks to that article and Fiddler, you can simply login from tfx-cli to your TFS 2015 without any problem.

image

Figure 1: Login against your local TFS Service

Once I’m logged in, I can simply use the very same command used for VSTS to upload the directory where I defined the Build Task on my local TFS on-premise Server.

image

Figure 2: Task was uploaded to the server

As you can see the task was uploaded to the server, exactly in the very same way I uploaded to my VSTS account. The task is now available to be used in my TFS.

image

Figure 3: Custom task in action in a TFS 2015 on-premise build

Thanks to the extensibility with PowerShell I did not need to care about versions of VSTS or TFS, because the script does not have reference on any dll or package and the same task can be used both in VSTS or in TFS 2015 without changing a single line.

Thanks to the new Buidl System, extending a build for both VSTS and TFS is now a simple and easy task.

Gian Maria.

Execute powershell code during a build in TFS 2015 Update 2

In TFS 2015 build system, running a PowerShell script stored in source code is simple because there is a dedicated action to accomplish this task, but if you want to run a PowerShell script that is not in source control, you have no option out of the Box.

Thanks to Update 2, you have now the ability to use the extensions you can find on Visual Studio Marketplace directly in your on-premise TFS installation. In the Upper Right corner of Web Ui you can find an icon that link to

This image shows the link in TFS UI to open the control panel to manage extension.

Figure 1: Link to manage extensions

This opens an administration page that allows you to manage extensions of your TFS installation. The first time you open this page, you will see no extension installed, so it is time to browse Visual Studio MarketPlace to find an extension. Actually I want to run inline PowerShell and I can immediately find that there is an extension that can solve my need.

As you can see from Figure 2, this extension have a couple of button, the first one, Install, is used to install this extension on one of your VSTS account, but if the extension is compatible with on-premise TFS you have also the option to Download the extension.

This image shows that extensions can be downloaded to local pc to be installed to TFS

Figure 2: Once you find an extension compatible with on-premise TFS you can download it.

The extension is a simple .vsix file, and from extension administration page you can upload to your TFS.

This image shows how you can upload downloaded extension to your TFS instance.

Figure 3: Once downloaded you can upload the extension to your TFS.

The process of uploading is really simple:

This image shows how you can choose the file to upload

Figure 4: Browse for downloaded extension

Tfs shows info for file to upload

Figure 5: Upload UI shows all the detail of the file

Now you can press Upload button, and the extension is uploaded to TFS and ready to be activated.

TFS shows the list of uploaded and installed extensions

Figure 6: Uploaded extension is now listed in the list of available extension

For each extension TFS ask you to install in specific project collection

  1. Figure 7: Install the extension on one or more collection

The concept behind “install then activate” is that, once uploaded the extension is available for the TFS Server instance, but then you should install in each Project Collection where you want to use that extension.

TFS asks you to choose the collection where you want to use the extension.

Figure 8: Choose the collection you want to install the extension into

Once you choose the Project Collection you need to confirm the operation

Figure 9: Confirm the selection

Once the Extension is installed in one Project Collection it can be used. In this example the extension contains a new build Task that allows you to execute an arbitrary PowerShell script during the build. To verify that everything is ok you can create a build and verify that the new Task is available and ready to use.

the extension is used in a build, where I was able to add the new task that executes arbitrary powershell code

Figure 10: The extension is ready and can be used

Thanks to TFS 2015 Update 2 you can Download and install extension for VSTS Marketplace to your on-premise TFS installation with few clicks.

Gian Maria.

Add Reporting to an existing Team Project

In previous post I demonstrated how you can create a Team Project from Web Interface thanks to TFS 2015 Update 2. The only drawback of this approach is that no Sharepoint Site and no Reporting Services portal are created.

While SharePoint integration is now an uncommon requirement, reporting services are still used. After my new Team Project (namedTest Project 2 ) was created from web interface, I verified that nothing gets created in my Reporting Services instance.

image

Figure 1: No reporting was created for new Team Project

Thanks to TFS Power Tools you are able to create both SharePoint portal and Reporting services for an existing project.

You can add reporiting with the tfpt.exe power tools command line utility. As an example here is the help for the addprojectreports command, used to create reports for an already created Team Project.

This image shows the list of options available to the addprojectreports command.

Figure 2: Help of the addprojectreports command

This is the exact command line I need to recreate reports for my Team Project is:

tfpt addprojectreports 
	/collection:http://tfs.cyberpunk.local:8080/tfs/ExperimentalCollection 
	/teamproject:"Test Project 2"
 	/processTemplate:"CMMI"

After a little while tfpf.exe created everything as I can verify from Reporting Services Site, now I have the usual folder for the Team Project that contains all Reports.

After tfpf addprojectreports command all reports for the team project are correctly created in Reporting Services Site

Figure 3: Reports were created for the Team Project

The same can be done with SharePoint portal. Thanks to Power Tools you can create the Team Project directly from the Web Site and add portal or reports subsequently and only if you need them.

Gian Maria.

Create a Team Project from Web UI in TFS 2015 Update 2

Creation of a new Team Project is a feature that traditionally was available only from Visual Studio in TFS on-premises. You do not need to have a full Visual Studio installation, you can only install the Team Explorer component, but in 2015, unfortunately, the stand alone installer for Team Explorer is Gone.

It turns out that, after upgrade to 2015 you should install Visual Studio Express or Visual Studio Community to create a Team Project.

Another problem is that you need to use the right version of Visual Studio if you want to be sure that you are able to correctly create Team Project. If you try to create a Team Project in TFS 2015 with an early version of Visual Studio, the operation could probably fail.

Thanks to TFS 2015 Update 2, finally we are able to create a Team Project directly from the Web Interface, without the need to have Visual Studio installed. This is a really small feature, but I think that lots of people will be glad that it is now available.

Thanks to TFS 2015 Update 2, finally we are able to create a Team Project directly from the Web Interface

The experience is still not complete, as an example the Web procedure is not able to create Sharepoint Site (if you connected Sharepoint with TFS) nor is able to create Reporting Services based resource. Even with this limitations, this functionality is really interesting. You can access it directly from the Team Project Collection Administration page

New Team Project menu after installing Update 2, this picture shows how Update 2 brings in the ability to create a Team Project directly from Web site

Figure 1: New Team Project menu after installing Update 2

If you choose to create a new Team Project you get a dialog really similar to the one you get in VSTS.

This image shows the dialog in web interface to create a new Team Project. In the top section there is the warning about Sharpoint and Reporting Services

Figure 2: Dialog to create the new Team Project

You can fill all the details you need then press “Create Project” button and you can simply wait for you server to create everything about the Team Project. As for VSTS you can close the Window with the progress bar, because all operations are done in bacgkround. After a little while you should be able to access the new Team Project.

Gian Maria.