Generating _PublishedWebsites in TFBuild

We have slowly been migrating our XAML builds to TFBuild. After having blogged about how we created custom build tasks we were finally ready to start transitions our builds. At our company we have basically 3 different kinds of builds – ASP.NET apps, console applications and REST APIs. Using XAML builds our deployment process was configured to look for the _PublishedWebsites directory for ASP.NET apps but that doesn’t get created in TFBuild. Hence I spent some time looking for a solution.

Read More

Create a Build Task for TFBuild, Part 2

In the last post I demonstrated how to create a build task for TFBuild that showed the build variables. I also demonstrated how to wrap the task in a build extension that could be installed in TFS, on-premise. In this post we’ll add another task to the extension. This serves two purposes. Firstly it demonstrates hosting multiple tasks in a single extension. Secondly it demonstrates a more common build task, versioning assemblies.

Read More

Create a Build Task for TFBuild

There are many articles around how to build tasks for TFS 2015’s newer build system (TFBuild). This is yet another one that tries to consolidate the information floating around into a central location and includes information for deploying to an on-premise TFS server.

Read More

Upgrading TFS 2013 Process Templates

A while back we wanted to make some changes to our process template. The template was selected back when we switched to TFS 2010 and has been used every since. We’re using TFS 2013 now. The problem is that we had no idea which variant of template we were using. There are several flavors and versions of Agile, SCRUM and even CMMI. Searching online revealed that most people just recommend setting up a new team project but that was out of the question. We had years of history and work items that we didn’t want to migrate. So we opted to go through the tedious process of upgrading our template manually to the latest version before making our customizations. This is a summary of what we did in case anyone else needs to go down this road.

Read More

TFS Upgrade Nightmares

UPDATE 1: Unfortuately not everything is going well with the reports. We were finally able to track down that the issue was with the user account I was using to configure TFS. Evidently you need to be an administrator on the machine hosting the SSRS instance (not just an admin for SSRS). Without admin privileges you cannot access the WMI provider remotely which causes the configuration to fail.  Needless to say the network admins were not pleased. They tried to strip things down to the minimal privileges but nothing short of full admin worked.

UPDATE 2: We have run into another, more serious issue though, we can no longer create new team projects in any collection. I can create a new collection but creating any team project fails. It always fails when trying to create the SSRS reports and the error message is useless. The error message says it cannot connect to SSRS so the host name is bad, the connection timed out or the database is corrupt. Now I’m really annoyed. In a last ditch effort we are rebuilding the reporting databases. If this doesn’t work we may need to retreat back to the old server.

UPDATE 3: Someone from the TFS team responded that all you need to do to move the database is the following:

  • Stop the collection
  • Backup/restore the database
  • Edit the collection settings to move the database

UPDATE 4: We finally resolve the team project creation issue. It turns out that moving the SSRS database and having TFS reconfigure to use it doesn’t restore all the permissions correctly. Thanks to this post I was able to run just the permission update scripts and we’re back in business.

I do see these options in TFS but I’m not sure whether that would include the configuration database (which got moved as well) or just the collection database. The next time I need to move the database I’ll have to try it and see.

Recently we needed to upgrade our TFS 2012 server to TFS 2013. The last time we upgraded TFS 2010 to TFS 2012 it was a nightmare so we took some more precautions this time. Alas they didn’t help. This upgrade proved to be just as big of a nightmare as the last time. Here’s my story of upgrading TFS based upon my 2 previous attempts.

Read More

TFS 2010 In Offline Mode

The initial release of TFS did not support having offline clients – meaning it did not support clients that could not connect to the server.  This introduced quite a few problems for folks would might work from home or on the train.  With VS 2008 SP1 (I believe) offline support was partially supported but it required that you use the TFS Power Tools.  With TFS 2010 it is getting a little easier.  Recently I had the need to work offline and I wanted to share the process with others who might be going down this same road because it is not quite obvious.

The Problem

First we need to set the stage for where problems can occur.  If you start up VS and attempt to load a project contained in TFS and TFS cannot be found then VS will prompt you to work in offline mode.  VS only does this when loading a solution. 

So far so good.  If TFS goes offline while a solution is already open though VS will not switch to offline mode.  Instead it’ll keep trying to connect to TFS and then time out.  This is really inconvenient.  It is made worse if you happen to have any files modified, not checked out yet and the appropriate check out options set because you won’t be able to save the files at all.  Really annoying. 

Before continuing let’s be clear about when VS will attempt to check out files.  The options reside in ToolsOptions -> Source ControlEnvironment.  The Checked-in Items – Saving option determines what happens when you attempt to save a file whereas the Editing option determines what happens when you try to edit a read-only file.  The default in both cases is to automatically check the file out.  If TFS is offline then these operations will time out and VS will not allow you to continue.

Making TFS Offline

To get VS to realize that TFS is offline and to force VS into offline mode you have to use the TFS Power Tools that ship external to TFS.  The Power Tools ship with a command line utility called ‘tfpt’.  If you run this command with the ‘tweakUI’ option then you will get a nice little UI for working with TFS.   

(NOTE: The version that ships with TFS 2010 RC does not appear to have the UI available.  I use the version from TFS 2008 instead.)

Selecting the appropriate server and clicking Edit will take you to the server properties dialog.  Within this dialog is an option to force the server into offline mode.  Note that this only impacts VS and not TFS.

Now VS is in offline mode.  This takes effect immediately (even if VS is already open).  Once you set the server to offline mode you still have an extra step to take.  Each file that you want to edit will need to be modified to not be read-only.  You should remove the read-only flag only on those files that you modify.  Doing this will allow you to edit and save files while offline.

Note that TFS will remain offline until you re-run tfpt and uncheck the offline option.

Synchronizing Back to TFS

When you finally connect back to TFS it is important that you synchronize TFS with your changes.  To do this do the following:

  1. Open a command prompt.
  2. Change to the directory where your workspace is mapped.
  3. Run the tweakui command again and uncheck the offline option for the server.
  4. Run the following command: tfpt online

Tfpt will examine the entire directory structure looking for any files that are not read-only.  For each file it will check the file out of TFS if it is not already checked out.  It will also do adds and removes.  You should confirm all the pending changes before checking the files into TFS.  Once you’ve completed these steps you are working with TFS normally again.