Our server that has been used for our build drop locations is being retired. I know how to change the current build definition to use the new server, but how do you change the historical records for builds that have already completed? I want to be able to open past builds and click on 'Open Drop Folder' and be taken to the new server. We will manually copy the old builds to the new server.
-
Is the entire server being retired? Or is the server sticking around but you can no longer use it for your drops? If it's the former, you could use DNS / WINS aliases to route the old build drops to the new server. – Edward Thomson Mar 09 '12 at 19:19
-
1Yes the whole server is being retired. We thought about the DNS/WINS alias as an option, but worry someone will forget why the entry may exist and wipe it out later. (Don't ask...) – Mike Becatti Mar 10 '12 at 01:52
2 Answers
The following sample seemed to work:
using System;
using System.Collections.Generic;
using Microsoft.TeamFoundation.Build.Client;
using Microsoft.TeamFoundation.Client;
namespace ChangeDropLocation
{
class Program
{
static void Main()
{
TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://MyServer:8080/tfs/Collection"));
var buildService = (IBuildServer)teamProjectCollection.GetService(typeof(IBuildServer));
IBuildDetail buildDetail = buildService.GetBuild(new Uri("vstfs:///Build/Build/1506"));
buildDetail.DropLocation ="\\somewhere";
var buildDetails = new List<IBuildDetail>();
buildDetails.Add(buildDetail);
buildService.SaveBuilds(buildDetails.ToArray());
}
}
}
One thing that you should take into account is that you 'll probably be lacking the privilege to update build information. In my first attempt, although I am a Project admin, I got the following:
TF215106: Access denied. DOMAIN\username needs Update build information permissions for build definition myBuildDefinition in team project MyTeamProject to perform the action. For more information, contact the Team Foundation Server administrator.
In order to overcome this, set the right by right-clicking in TeamExplorer "Builds" & then select "Security...".

- 8,524
- 2
- 33
- 48
-
So..does this actually update the drop location in historical 'completed' builds? Or is this just updating the current build definition in batch? – JohnZaj Jul 08 '14 at 16:20
I don't know of any tool to do this. Maybe there is a TFS powershell command, but short of that I think you could - AFTER TAKING PROPER PRECAUTIONS OF COURSE - update the SQL Db directly.
The mapping to the drop location is stored in the collection SQL Db in tbl_Build.
select [DropLocation],[DropLocationRoot],[LogLocation] from [tbl_Build]
I'm not sure if there are any implications on the warehouse though. Might want to check on that first.
I believe Microsoft generally recommends against manipulating SQL directly for stuff like this. You could use the TFS API instead which would be a relatively safer approach.

- 1,132
- 8
- 12
-
I was hoping to avoid modifying the database. I was hoping for a tool. I could always use the API like you mentioned. – Mike Becatti Mar 09 '12 at 18:33
-
2Please don't ever touch (even SELECT queries) the operational databases. This is completely unsupported and the TFS team can and will refuse support if you start messing with the databases. There is actually a way to do this using the API. I'll have to get the code and post here to update this in a supported way. – Ed Blankenship Mar 10 '12 at 14:17