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.


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.


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.


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.


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 
	/teamproject:"Test Project 2"

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.

TFS 2015 Update 2 is released

You can find all the details directly in Visual Studio Site, but I want to emphasize that TFS and VS Updates are much more than Service Packs, because they also intrdoduce a lot of new features. Here is a list of my personal favorites features of TFS Update 2

Introduction of new Release Management System

New release management system is completely Web and does not require separate client to download, but this is not the only advantage. This update introduces the ability to integrate with VMWare, and have a new extension to connect to System Center Virtual Machine Manager.

Delete of work item from the UI

This solves probably the most common question I got during TFS Courses. Basically every attendee asks “how can I delete Work Item?”. The usual answer is, you need to resort to Command Line utility, because deleting a Work Item actually deletes its history from database and its a dangerous operation to do.

This is not always true, there are lots of legitimate reasons to delete a Work Item and now it is possible to delete Work Items directly from the Web Interface. Deletion actually move Work Items to a Recycle Bin where you could still restore deleted Work Items or delete permanently.

Extension from marketplace

This is another really cool feature, Marketplace was available until now, only for VSTS accounts, but now you can add extensions even to your TFS on premise instance.

Gated Check-in for new build system

This was another great stopper for customer to adopt the new build system, until Update 2 the new build system has no support for Gated Check-in. With Update 2 you can create a Gated Check-in TFVC vNext build

New Link from Git Code and Work Items

Now you can link a work item not only to a Commit in Git but also to an entire branch. This is really interesting if you work with GitFlow and are used to feature branches. With this approach you can link each PBI or User Story directly to Git Feature branch that is implementing it.

This is especially useful for Scrum Team, because you can create a pull-request for all Completed User Stories of the Sprint, and do a review. Then, during Sprint Review, you can complete pull requests only for those User Stories that are considered completed by the Product Owner. All the User Stories that are still not considered completed will flow to the Next Sprint, postponing the Merge.

I strongly encourage you to have a look at the full list of the new feature, and, as always, I strongly suggest you to always upgrade your TFS to the latest version, to have all the latest bugfix and to avoid Big Bang upgrade that spans multiple versione (ex 2008 to 2013, or 2010 to 2015).

Gian Maria.