Showing posts with label TFS. Show all posts
Showing posts with label TFS. Show all posts

Tuesday, December 22, 2009

To-do list in TFS Project Migration

I can think of at least two reasons why project migration is not avoidable in TFS 2008.

  1. You want to rename your project. For complicated reasons, renaming is not supported in TFS. So the only you can achieve this is to create a new project then migrate everything.
  2. You want to change the process template you used in TFS project. Changing the template is not supported in TFS 2008 either.

Migrating the team project, you can easily think of three parts.

  1. Source control code
  2. Work Items
  3. SharePoint Documents

However there are other things you need to consider too.

  1. TFS groups and membership
  2. TFS security settings
  3. TFS queries

Some of these items are manual processes.

  • Like work items migration, you need to use TFS query to get the work items you need, then export to excel then import to the new TFS project.
  • SharePoint Documents.
  • TFS queries
  • TFS security settings.

Some of these items you can accomplish using scripts.

  • Group membership migration. I found one good tool you can utilize to migrate group membership in CodePlex
  • Source code migration. You can simply use TF.EXE to compose a batch file.

Before the migration you should consider to stop TFS SQL server's transaction log jobs. Then migrate. Restart the SQL transaction log job. Re-index the database to achieve the ultimate performance.

Wednesday, February 11, 2009

Use Visual Studio 2008 SDK to customize TFS


Recently I got a chance to assist someone in the other project of my client to generate a report from TFS. He needed a report of all the details of the changeset in certain period of time. I managed to write some sample code for him with Visual Studio 2008 SDK 1.1 which provides API to query TFS history and get the change-set details.

The code is in C#. The test was very successful; I could query the history; then I got changeset list; then I used the changesetid to get all the objects (change instances). There are two main methods you can find in the attached solution. –QueryHistory [1] and GetChangeset[2].

[1]: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.queryhistory(VS.80).aspx
[2]: http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.versioncontrolserver.getchangeset(VS.80).aspx

Sample code:

        private static IEnumerable QueryHistory()
{
TeamFoundationServer tfs = new TeamFoundationServer(tfsName);

// Get a reference to Version Control.
VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
string path = @"$/YOUR-TEAM-PROJECT-NAME";
VersionSpec version = VersionSpec.Latest;
int deletionId = 0;
RecursionType recursion = RecursionType.Full;

string user = "YOUR-USER-NAME";
// VersionSpec versionFrom = VersionSpec.ParseSingleSpec("115894", "mahesh_lambe");
//keep it 'null' for first version
VersionSpec versionFrom = null;

// VersionSpec versionTo = VersionSpec.ParseSingleSpec("109014", "mahesh_lambe");
//keep it 'null' for latest version
VersionSpec versionTo = null;

int maxCount = Int32.MaxValue;

bool includeChanges = true;

bool slotMode = true;

bool includeDownloadInfo = true;

IEnumerable enumerable = versionControl.QueryHistory(path, version, deletionId, recursion, user, versionFrom, versionTo, maxCount, includeChanges, slotMode, includeDownloadInfo);

return enumerable;
}


        // Get a reference to our Team Foundation Server.              
private static String tfsName = @"http://YOUR-TFS-SERVER-NAME:8080/";

internal static Changeset GetChangeset(int _changesetNumber)
{
TeamFoundationServer tfs = new TeamFoundationServer(tfsName);

// Get a reference to Version Control.
VersionControlServer versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
Changeset ch = versionControl.GetChangeset(_changesetNumber, true, true);

Console.WriteLine(ch.ToString());
return ch;
}

Is High Quality Software Worth the Cost?

I can't agree more with Martin Fowler's post on "Is High Quality Software Worth the Cost?". Here is just a repost. https:/...