Thursday, December 20, 2007

TfsBuildLab v1.1 is released!!!

Just in time for christmas we have finnished up what is likely to be the last version (unless you guys using it request any new features or find any defect) since TFS 2008 is out there with most of the functionality covered. Altough TfsBuildLab is still a viable solution for all you guys that are unable to upgrade.

You can download the latest release form here

Some statistics since the start (didn't have the time to do the graphs this time):
We have been dog fooding TfsBuildLab in production since 2007-04-24 on a several projects the largest of them consisting of 5 parallel development branches each containing aproximately 10 000 source files.

4969 Automatic cleanups
2511 Scheduled builds
2238 Continous integration builds

What's new in version 1.1?

We have improved the errorhandling dramaically in this release as well as tried to include more contextual information in the logs.

Service

* Added support for multiple build servers assosiaed to a trigger.
* Added support for status notifications out build completion.
* Fixed problem with to many changeset involved in build failure notifications when * checkin occurs at the same time as a build is failing.

Admin Client

* Overview of scheduled builds for a team project.
* Support for multiple reports on the dashboard.
* Add transaction support when copy config, this addresses the problem of caches becoming corrupt.

Notification Client

* Support for notification on assignment changes to work items.
* Fixed problem with the configuration no always being persisted.

Please let us know if you are using it, if you have trouble using it or if you have any requests for features. All feedback is wecome.

Sunday, December 2, 2007

Update your old Team Project portals to use the new WSS 3.0 look and feel

I am by no mean an expert on Windows Sharepoint Services, but never the less we wanted to upgrade to WSS3.0 when we switched to using TFS 2008 and this proved to have some quirks that needed some sorting out.

After you have upgraded you TFS 2005 installation you need to upgrade the WSS 2.0 installation manually (this is not part of an upgrade). To do this you can read the following post, it refers to the Beta version of TFS 2008 but the procedure is the same.

You'll need the prescan tool to perform the upgrade as well. You can find more details about this in the documentation section Upgrading SharePoint Products and Technologies for Team Foundation Server

Once you have upgraded your sharepoint installation you will notice that the old projects doen't quite look as slick as any new project portals you create...


As you can see below the new sites created have alot of new navigational features that will make your users life easier such as the sites section on the quicklaunch and the top bar (the tabs) is handled more correctly and it has a slicker look (atleast in my opinion)...


To get around this you need to do the following steps (this is a solution that works for companies that have a not to large number of Team Project portals since it involves some manual steps):

Step 1: Navigate to your portals site settings and then from the look and feel menu select the option Reset to site definition (as shown in the picture):


make sure that you reset all the pages in your site


This will make the site look like a newely created project portal, unfourtunately it will also break a few things that you'll need to fix manually.


As you can see the Process Guidance link and the Reports link have dissapeared. Also the Team System logo on the top of the page has vanished (this I have no clue on how to fix at the moment).

Step 2: Navigate to the site settings of your site and under the look and feel section select the Top Link Bar and remove all links that are not subsites (Home, Documents and Lists, Create, Site Settings and Help).


Step 3: Navigate to the site settings of your site and under the look and feel section select the Quick Launch and remove all none wanted links (typically Pictures, Lists, Discussions and Surveys).


Step 4: Recreate the Process Guidance section in the Quick Launch sidebar

/sites/[YOURSITE]/Process%20Guidance/ProcessGuidance.html


Step 5: Recreate the Reports section in the Quick Launch sidebar
/sites/[YOURSITE]/_layouts/tfsredirect.aspx?IsReport=0


Step 6: Then add the links to the reports you had previously, for example to add the Bug Rates report.
/sites/[YOURSITE]/_layouts/tfsredirect.aspx?IsReport=1&ReportName=Bug+Rates&ShowToolbar=1


That is it, please comment if there are better ways todo this I'd love to get some pointer on how to do this easier (I guess you could do it by scripting?).

Finally if you have a bunch of highly customized templates that you are using you can find more information about how to covert them to WSS 3.0 in the Upgrade Toolkit for Windows SharePoint Services Sites and Templates Guide which was pointed out to me by the nice folks at Microsoft.

Thursday, November 29, 2007

TSWA 2005 crashes (Attempted to read or write protected memory)

A while back when we started using Team System Web Access 2005 we bumped into a problem with the website crashing sometimes several times during a day displaying the following error:

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
we where able to get around it by manually go in an recycle the application pool for TSWA (which temporarily solve the problem).

Clearly this was not a sufficient solution so after chatting about it with the good folks over in Redmond they where able to pinpoint the problem (this is as far as I know only a problem in TSWA 2005). To solve the problem you need to do the following:

Switch TSWA over to use shared WIT cache mode which can be done by adding the following entry in the web.config for TSWA:
<configuration>

<appSettings>
<add key="WorkItemTrackingCacheRoot" value="C:\FolderForCache" />
</appSettings>

</configuration>
After we added this entry we have experienced no problems with this.

Those pesky TestType doesn't exsists error messages

Recently I had some problems with publishing of the test results for our test runs performed with a tool called AutomatedQA TestComplete.

No matter what we did the only message we got back was:

Publish Failed. Test Type not installed on the server for test type: "TestComplete6.VSI.Tests.TestCompleteTest"
After a fair ammount of digging I finally found the solution and this applies to any custom test type used together with TFS (so I figured I'd share the information).

As you can read in the documentation regarding custom test types you not only have to install the test type on the machine i has to be available in the probe path for the web services as well.
Test type extension assemblies must be installed to two locations on the applicationtier computer:

To support the publishing Web service, install test type extension assemblies to this folder: Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Build\bin. This service publishes test results from Visual Studio to the application tier.

To support the data warehouse adapter, install test type assemblies to this folder: Program Files\Microsoft Visual Studio 2005 Team Foundation Server\Web Services\Warehouse\bin\Plugins. This adapter pushes test result data into the data warehouse for reporting.
This MSDN documentation section explains it all Packaging and Installing Test Type Extensions in Visual Studio Team System

And if you are considering writing your own custom test type be sure to read through this Creating Custom Test Types in Visual Studio Team System.

I didn't find all that much information around this when digging around the net but this article gives some pointers on writing custom test types as well Create a Custom Test Interface Provider for Team System

Wednesday, November 21, 2007

Come chat with the Team System product group - December 5th

It's time again for a chat with the Team System Product Group, make sure that you clear you calender on the 5th of december.

Join members of the Visual Studio Team System product group to discuss features available in Team Foundation Server, Team Suite, Architecture Edition, Development Edition, Database Edition, and Test Edition. In addition, discuss what's new for these editions for Visual Studio 2008.
Read more about it here.

Sunday, October 14, 2007

TfsBuildLab v1.0 is out there !!!

Finally we are feature complete as we intended it to be from the start (download it from here) we missed out intended deadline by almost 3 weeks :( (before 22/9) but for a sparetime project it still is decent... We have now been dog fooding TfsBuildLab in production since 2007-04-24 on a several projects the largest of them consisting of 5 parallel development branches each containing aproximately 10 000 source files.

Some statistics since the start (didn't have the time to do the graphs this time):

2998 Automatic cleanups
1554 Scheduled builds
1359 Continous integration builds

And here's how it looks over time:


What's new in version 1.0?

Service

* Automatic rescheduling when adding new scheduled trigger.
* A report for displaying statistics from the triggers and retention policies.
* Support for overriding build script parameters both for CI and queued builds.
* Support for only deleting the build drops.
* Support for configuring retention policies based on build quality.
* Performance improvements by introducing caching

Admin Client

* Added feedback when delteing multiple builds.
* Support for forcing recaching on the server.
* Support for overriding build script parameters on queued builds.
* Support for overriding build script parameters on triggers.
* Added range paramters when listing log entries to limit the result data.

Checkin Policies

* Removed the need for TfsBuildLab when using the restricted paths policy.

Build Task

* New custom build task to use overloaded parameters (LoadOverriddenProperty)

Please let us know if you are using it, if you have trouble using it or if you have any requests for features. All feedback is wecome.

Friday, October 12, 2007

Speaking at OreDev about our experiences with implementing and extending Team System


Just wanted to do some advetising :) I'm gonna speak at OreDev this year about our experiences when implementing and extending Team System. Check out the session description here.

So if you are in the neighbourhood on November the 13th come listen and maybe swap some was stories?!?!

Automated builds of Visual Basic 6 project with Team System

Way back when we started to implement TFS as our primary provider for source control and build automation we experienced a fair ammount of pain due to the fact that we had a large body of Visual Basic 6 code that we needed to build using Team Build.

Since there is still not that much information about this I decided to do a post about it.

There are not that much to it but it has one quirk that you need to understand to get it to run smoothly. You have to use the /out argument and supply a path to a logfile that will capture the input.

It's rather easy to say nah I don't need that information and run without using this argument. The problem then will start with the fact that even if you build vb6 projects using the commandline switches the IDE will prompt for input when failures occurs and block the build script indefinitly. It wont work just using the timeout property on the exec task either since this will leave the process running and locking the files and thus you will get a failed build the next time when Team Build attempts to clear the workspace.

Using the exec task

"This approach requires no external components but does not report any information back in the build report"

<propertygroup>
<VB6>$(ProgramFiles)\Microsoft Visual Studio\VB98\VB6.exe</vb6>
<VB6Output>$(BinariesRoot)\VB6\</VB6Output>
<VB6Timeout>150000</vb6timeout>
</propertygroup>

<target name="CompileProject"
   inputs="%(ProjectToBuild.Identity)"
   outputs="Compiled %(ProjectToBuild.Identity)">

<message text="CompileProject: %(ProjectToBuild.Identity)">
<makedir directories="$(VB6Output)" condition="!Exists('$(VB6Output)')">

<exec condition=" '@(ProjectToBuild)'!='' "
   command=""$(VB6)"
      /m "%(ProjectToBuild.Identity)"
      /outdir "$(VB6Output)"
      /out "$(VB6Output)VB6.log""
   timeout="%(VB6Timeout)">

</target>

Using a custom build task

"This approach requires and external component which is included in my petproject TfsBuildLab. The benefits with this is that the feedback is instant in the build report. Pleas note that the script below describes what the usage would look like using the build task VB6Build"

<propertygroup>
<VB6>$(ProgramFiles)\Microsoft Visual Studio\VB98\VB6.exe</vb6>
<VB6Output>$(BinariesRoot)\VB6\</VB6Output>
<VB6Timeout>300000</vb6timeout>
</propertygroup>

<Target Name="CompileProject"
   Inputs="%(ProjectToBuild.Identity)"
   Outputs="Compiled %(ProjectToBuild.Identity)" >

<Message Text="CompileProject: %(ProjectToBuild.Identity)" />
<MakeDir Directories="$(VB6Output)" Condition="!Exists('$(VB6Output)')" />

<VB6Build TeamFoundationUrl="$(TeamFoundationServerUrl)"
   BuildUri="$(BuildUri)"
   CompilerPath="$(VB6)"
   ProjectFile="%(ProjectToBuild.Identity)"
   Timeout="$(VB6Timeout)"
   Output="$(VB6Output)" />

</Target>

Finally here are some links to a couple of postings that has been usefull for me when dealing with issues regarding building none Visual Studio 2005 related solutions...

Building Non-MSBuild Projects With Team Build by Aaron Hallberg
Team Build DevEnv Task by Aaron Hallberg

Building binaries targeting .NET 1.1 and .NET 1.0 in TeamBuild by Nagaraju Palla

Removing the process guidance link from your portal


Just another small post about the team project portal and the layout. If like we don't have the possibility to produce the kind of flashy process guidance that comes with the SharePoint templates provided by Team System, but still have to modify the actual process (i.e. you can't use the one provided out of the box) you might want to remove the incorrect process guidance from your portals to avoid confusion.

It is not that hard once you understand that you need to use Frontpage 2003 to edit the behaviour of your portals. So here are the steps to remove the process guidance like from an already created portal.

1, Open site in question
2, Open default.aspx for editing
3, Select the process guidance and the row below.
4, Right click and select cut
5, Save chanes made to default.aspx

That's it! But don't forget to remove the document library containing the guidance as well. Obviously it's better to actually modify the process guidance documentation or provide you own and create a new SharePoint template that's assosiated with your process template, but we are not always granted the luxury of being able to do all this during an incremental rollout of a major product like Team System.

Thursday, October 11, 2007

Creating a test server by cloning your TFS production environment

Not long ago we created a lab environment for testing out new concepts and testing upgrades on an so on. We then had the brilliant :) idea that we should perform a clone by using the disaster recovery techniques describe in the msdn article: How to: Move Your Team Foundation Server from One Hardware Configuration to Another

This worked great and we suddenly had a realistic lab environment, atleast that's what we though. Fourtunately for us we didn't have time to do anything with this new server after we created it and some time passed. During this time we created additional team projects and everything was fine.

Imagine my suprise when we started using the test server and all of the suddenly saw the new projects on this server as well. After som digging around and talking to Microsoft support we where directed to an post by Buck Hodges that points out that the problem resides in the fact that when we restore the databases on another server we end up with 2 instances of TFS running with ther same instance ID (a guid stamped in the database). Since this guid is cached on the client it can cause all kinds of nasty issues if you access both servers from the same client.

Anyway here's howto fix it:


Clear the client cache
Delete the directory %userprofile%\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache.

Clear the instance info
“%TFSInstallDir%\Tools\InstanceInfo.exe" stamp /setup /install /rollback /d TFSWorkItemTracking,TFSBuild,TFSVersionControl,TFSIntegration /s <your new data tier>

Create new instance info
"% TFSInstallDir %\Tools\InstanceInfo.exe" stamp /d TFSWorkItemTracking,TFSBuild,TFSVersionControl,TFSIntegration /s <your new data tier>

And here is the link to the posting Buck Hodges made about it: Creating a new server from an old one: Beware of the InstanceId

LinkMania: HowTo create a custom build step for MSBuild

There is not much to writing extensions to msbuild but I've put together afew links as a starting point.

The documentation would be a great place to start :) and it is very complete with alot of examples: How To: Write a Task

There are also a couple of really good posts on the msbuild team blog about this:
How To: Implementing Custom Tasks - Part I
How To: Implementing Custom Tasks - Part II
How To: Debug a custom MSBuild task using Visual Studio

There is also a great MSDN article on how the msbuild engine works and howto extended it here: Inside MSBuild Compile Apps Your Way With Custom Tasks For The Microsoft Build Engine

Broken navigation in team portal when deleting security or requirements document library

Lately I've been mucking about with the portal parts of Team System since we wanted to move our documents into SharePoint and gain all the benefits there.

We did however bump into a major issue that turned out to be a bug in the SharePoint templates in Team System. The bug is fixed in the upcomming release (TFS2008) in both template versions (WSS2.0 & WSS3.0).

The problem occurs when you delete certain document libraries from you portals, namely the security and requirements. This will corrupt the portal navigation (quicklaunch) and once you've ended up in a corrupted state you can not get any document libraries to appear on the quick launch.

The bug is related to some sort of hardcoding in the template concerning the security and requirements document libraries. You can test this by enabling "show on quicklaunch" in these document librareis. This will generate duplicates on the quicklaunch. And if you remove either of them the navigation breaks.


After some discussions with Microsoft support we came to the conclusion that if you delete the security or requirements document libraries (either through team explorer or through the portal), it seems that an orphaned element is left in the dbo.navnodes table of your SharePoint content database.


There is a way to remove these document libraries with out breaking the navigation. To do this you need to use FrontPage 2003 and connect to the site in question. Then open the file default.aspx and you will see the following section on the left.



Double click on either the security or requirements link and you will be presented with the "linkbar properties" dialogue. Then remove the link to the security and/or requirements document library from the quicklaunch.


When you have done this it's ok to remove the document libraries from any tool you choose.

If you like me have a trigger happy finger and don't like unused stuff and already have deleted the document libraries and are stuck with a broken portal there is a solution :).

NOTE THAT THIS IS NOT A SOLUTION SUPPORTED BY MICROSOFT!!! So you should know what you are doing when performing this recovery strategy and always make sure that you have a made a complete backup of both sharepoint databases before starting this procedure!!!

Step 1, Get the identity of the orphaned document library from the navigation nodes table.


SELECT DocId FROM dbo.navnodes
WHERE name = 'BrokenDocumentLibraryName' AND
SiteId IN (SELECT SiteId FROM dbo.Webs WHERE FullUrl = 'sites/TeamProjectName') AND
WebId IN (SELECT id FROM dbo.Webs WHERE FullUrl = 'sites/TeamProjectName')

Step 2, Verify that the document library actually is orphaned.

SELECT * FROM docs
WHERE Id = 'DocumentLibraryIdentity'

Step 3, Remove the orphaned document library from the navigation node table.

DELETE FROM dbo.navnodes
WHERE DocID = 'DocumentLibraryIdentity'

Sunday, August 26, 2007

TfsBuildLab goes Beta 2

Time sure does fly when you have fun :) it's time for beta 2 (download it from here) almost exactly one month after beta 1 (kinda puts some preassure to finnish the v1 before 22/9)... We have now been dog fooding TfsBuildLab in production since 2007-04-24 on a several projects the largest of them consisting of 5 parallel development branches each containing aproximately 10 000 source files.

Some statistics since the start (didn't have the time to do the graphs this time):

1854 Automatic cleanups
935 Scheduled builds
754 Continous integration builds

What is new in Beta 2?
´
Service

Support for tracing using trace listeners
Made automatic notification registration optional
Removed the need for LDAP to resolve email for notifications
Admin Client
Context menues with refresh commands
Full screen mode (press F11 to toggle)
Added hosting of reports in the dashboard
Minimize to tray
Sorting possibilities on the contents of the grids
Added Edit trigger/policy
Added Copy trigger/policy

Notification Client
Added support for executing alert commands
Notifications occurs when a build starts as well
Policies
A policy for restricting checkins based on a source control path
A policy for restricting checkins when the build is broken
A policy for requiring a comment when performing a checkin

Please let us know if you are using it, if you have troubles installing it or if you have any requests for features. All feedback is wecome.

Thursday, August 23, 2007

LinkMania: HowTo create a custom policy plug-in for Team System

First of all you'll need to download the Team Foundation Server SDK which is included in the Visual Studio SDK.

The most comprehensive guideline is most likely
Creating a Custom Check-in Policy for Team Foundation Server 2005 written by the Patterns & Practices team (sure wish I had this when I wrote my first plug-in).

The documentation on MSDN is also very comprehensive
Check-in Policy Extensibility.

Jim Presto wrote a series of blog posts on this way back that I still think are a very good place to look Create Policy - Step 1 and Create Policy - Step 2 are the best two in my oppinion.

Marcel de Vries obviously had way to much time on his hands when he wrote How to build a custom check-in policy.

Friday, August 17, 2007

Retrieving user email & display name from Team Foundation Server

While working on the continous integration parts in our project TfsBuildLab we needed to resolve a users email based on the accountname retrieved when a checkin notification occurred. My first take was to go straight at the active directory implementing this using LDAP.

However this is some what limiting so I was mucking about and trying to find out how to do it using the TFS api and guess what it isn't that hard at all the following sample illustrates how to do it and at the end of this post I've tried to explain some of the details of the method being used.


using System;
using System.Net;
using Microsoft.TeamFoundation.Client;
using Microsoft.TeamFoundation.Server;

public Identity GetUserInfo(string accountname)
{
    string tfsUri = "YOURTFSSERVER";
    string tfsUser = "YOURTFSACCOUNT";
    string tfsPassword = "YOURTFSPASSWORD";

    NetworkCredential nc = new NetworkCredential(tfsUser, tfsPassword);

    TeamFoundationServer tfs = new TeamFoundationServer(tfsUri, nc);

    IGroupSecurityService gss = (IGroupSecurityService)tfs.GetService(typeof(IGroupSecurityService));

    Identity identity = gss.ReadIdentity(SearchFactor.AccountName, accountname, QueryMembership.None);

    if (identity != null)
    {
       //how to get the email
       //string email = identity.MailAddress;

       //how to get the displayname
       //string displayname = identity.DisplayName;

       return identity;
    }

    return null;
}

IGroupSecurityService.ReadIdentity Takes three parameters the first being of the type SearchFactor which lets you specify how you intend to identity the user/group that you which to retrive information about the two most intressting ways (in my oppinion) would be:

SearchFactor.AccountName lets resolve identity based on a windows or tfs identity. The syntax being domain\username or projecturi\groupname

SearchFactor.Sid lets you enter a sid and get back the information about that particular user/user. The syntax being S-1-5-21-1681502023-2202157333-1552196959-1028

The second parameter is where you supply the actual identifier of the type you specified using the SearchFactor.

And the third parameter being of the type QueryMembership is where you specify how groups will be expanded. If you retrieve a group the Identity object you get back contains two member variables called Members (a string array containing the sid's of the members in the returned group empty if it's a not a group) and MemberOf (a string array containing the sid's of the groups the return group/user belongs to). You can specify this in the following way:

QueryMembership.None the quickest way to retrieve the information for a user if you don't need information on which groups he/she belongs to. The aboce mentioned variables Members and MemberOf will be null when using this.

QueryMembership.Direct will not expanded any groups that are members, but simply return the group as one sid.

QueryMembership.Expanded will expand any groups that are members and return the sid's for the contained users in the group.

Tuesday, July 31, 2007

TFS Now! A Hosting service of TFS announced...

Just saw a blog by Mitch Denny that Readify a aussie based consulting company with a strong presence in the TFS community has announce a service called TFS Now!

You can find out more here in the posting our surf to
www.tfsnow.com for more details about costs and such.

I personally think this is a great initiative since there are many smaller players that want/need to use TFS but simply don't have the resources to make it happen, now they can get all the benefits but none of the headaches. Some of you might say, but what about codeplex? Well the difference is that you don't have to make your projects public.

Monday, July 23, 2007

TfsBuildLab goes Beta 1

Finally it's released download beta 1 from here ... I started this project together with with Mathias Olausson in the begining of april and now it's finally time to release the first public beta version :)

What is TfsBuildLab then? It's and extention for Microsoft Team Foundation Server to provide additional functionallity to simplify day to day operations such as:

  • Continous Integration
  • Automatic Build Cleanup
  • Build Scheaduling
  • Build Queueing

It's loosley based on the Orcas continous integration specs which will easy the transition to use the native functionality once it's there and we will provide a migration tool once Orcas gets closer to being released.

We have been dog fooding this codebase in production since 2007-04-24 on a several projects the largest of them consisting of 5 parallel development branches each containing aproximately 10 000 source files.

Some statistics since the start:

  • 1251 Automatic cleanups
  • 551 Scheduled builds
  • 597 Continous integration builds
You can also examine these statistics over time in the followin diagram:

If there is anything you want to know about this project get in touch with us, any feedback is wecome.

Sunday, July 22, 2007

Naked conversations... fun reading for people begining to explore the blogosphere


Naked Conversations: How Blogs are Changing the Way Businesses Talk with Customers by Robert Scoble & Shel Israel

Finnished reading this one the boat back home from my vacation, it was kind of a long read since it never grabbed my attention and made me read from cover to cover.

Never the less it is a good read and in talks about some intressting topics on blogging and how it can change the way businesses interact with their customers. The book is build around lots of interviews with prominent bloggers around the world and is built around blog postings so it feels more like reading a blog than a book.

It also gives a bit of background on where blogging comes from, all in all it's a good read for anyone intressted in blogging.

Saturday, July 21, 2007

Limitations using XPath and BisSubscribe

First of all sorry for being quite for the last few months but after all it's summer and vaction times. I've been enjoying such activities as island hopping in Greece with the family, renovating the house (which mostely sucks) and the occasional spare hour of programming on my pet project TfsBuildLab (which I hope will get it's first public release this weekend).

Anyway, from now on I'll try to be more regular in my postings, I'll start with finnishing of a few that has been laying around in draft mode for awhile now :)

First out as the title states is a smaller limitation I bumped into when trying to setup email notfications using the built in functionality in TFS (namely BisSubscribe.exe which you can read more about in my previous posts here and here).

Imagine that you need to setup a notification whenever a checkin occurs on a particular file extension and prefer to use xpath over regexp. The following two xpath expressions as both legal xpath examples for this but only the first will work:

Artifacts/Artifact[contains(@ServerItem, ".cls")] <> null

count(Artifacts/Artifact[contains(@ServerItem, ".cls")]) > 1

The reason for this is the fact (which is illustrated by viewing the error message recieved when the notification filter is applied at runtime) TFS will append the filter you pass in to BusSubscribe with /CheckinEvent/ effectivly already positioning us in the document and we need to compensate for this.

TF53010: An unexpected condition has occurred in a Team
Foundation component. The information contained here should be made available to
your site administrative staff.
Technical Information (for the
administrative staff):
Date (UTC): 2007-04-05 10:25:08
Machine:
[SERVERNAME]
Application Domain:
/LM/W3SVC/3/Root/services-2-128202238136148894
Assembly:
Microsoft.TeamFoundation.Server, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a; v2.0.50727
Process Details:
Process
Name: w3wp
Process Id: 6176
Thread Id: 784
Account name:
[DOMAIN]\[ACCOUNT]

Detailed Message: TF50285: Exception matching
subscription: Microsoft.TeamFoundation.Server.SubscriptionOnServer:
System.Xml.XPath.XPathException:
'/CheckinEvent/count(Artifacts/Artifact[contains(@Folder, ".idl")])' has an
invalid token.

Monday, April 30, 2007

Do charity work through Live Messenger

After a strugle with a broken computer the past weeks I found myself reinstalling windows once again and when I was getting a version of live messenger I saw that microsoft has launch a new charity program.

They will donate a portion of their advertisement revenue generated through there Live services when ever you send a instant message using live Messenger, you can even choose the cause you want to support (mainly american organisations) read more about it here.

Test Mangement in Visual Studio 2005 Pro and above...

Microsoft recently announce their intentions to release there unit test framework that is included in all Team System versions of Visual Studio 2005 for the professional version of VS2005 as well. This was great news and whats even better is that the after getting feedback on the subject they have decided to include the testmanagement tools in the package as well, read about it here.

Sunday, April 22, 2007

TFS Migration Toolkit now available on CodePlex

Yesterday Microsoft announce a pre-release an upcomming power tool called TFS Migration and Synchronization Toolkit, you can download it here.

The toolkit aims to help people with the migration towards TFS and offers a set of apis to make life easier for people with heterogenous systems by helping with bi-directional syncronization. Be sure to check it out and remember to be share your solutions (CodePlex is a great place for this) my guess is we'll be seeing some nice integration tools soon.

And a quote to rember when playing with this comes from Matthew Mitrik:

Please note that this is a prerelease version of the Migration and Synchronization Toolkit. Several features are not complete and as testing has not completed, the code has the potential to contain bugs and overwrite data stored in TFS. Please be careful to use this only in a testing environment and not on live production data.

Another one from Robert Horvick:

Oh - and this is still under active development (and has known issues) so if you have any feedback it's still early enough for it to be considered for inclusion in the final drop.

Thursday, April 19, 2007

Recreating your WIT database (part 3/3)

So to round of this subject there are some alternative approaches that you can use.

Moving source control contents, this approach consists of creating a temporary project where you can host a copy of your source controlled contents during the recreation of the project the steps to do this are:

1, Create a new team project.

2, Move all your folders directly under the root of your team project to the new team projects root and checkin the changes.

3, Delete the project using TfsDeleteProject.exe.

4, Recreate the project with the desired process template.

5, Move back all your folders from your temporary team projects to the newly created project and checkin the changes.


The major drawback with this is that you will get a alot of activity in your merge process due to the fact that all files in all branches will get marked as changed and if you like us have a branch intensive environment this simply is not possible.

Finally you should look at the upcomming power tool TFS migration toolkit the team that is responsible for this tool has a blog where you can keep yourself updated on the progress. The migration toolkit is looking promising in alot of areas (one being the possiblity to perform a move of the source control database between projects with out affecting the contents in it).

Recreating your WIT database (part 2/3)

Ok, so we want to recreate the team project so we can apply a different process template on it (you really only have to do this in case you need to delete/rename work item types) but we don't want to loose all our history in source control.

Here are the steps you need to do:

1, Back up all your databases acording to the documentation mentioned in part 1 of this post.

2, Copy all your drops of your team builds to a backup location.

3, Delete the Team Project using TfsDeleteProject.exe.

4, Recreate the TeamProject using the correct template and the same name as before.

5, Restore the TfsVersionControl database to it's original state.

6, Restore the team build drops to theri original location.


There reason this works is due to the fact that the only thing that links source control to the rest of the Team System functions is the logical path name based on the team project name. Thus if you have a project called "DEMO" the link to version control will always be "$/DEMO". This will most likely change when the Orcas release of TFS hits the streets since then we will get all kinds of goodies to deal with problems like this.

I've tried this on many projects and most have been a success, I have not lost any project doing this but our main project (the reason for even thinking about this) failed misserably when doing this since it was to big and generated a timeout exception during the delete process leaving it in an inconsistent state (we had to restore it and resort to a different method, which I'll probably post a blog about as well).

In the last part of this post I'll point you to a couple of different approaches that you can take if you like.

Recreating your WIT database (part 1/3)

Been awhile since I posted something now, I'll blame the weather :). Spring has come to Sweden and it's really lovely so it has mainly been gardening and not so much messing about with blogging and Team System.

Anyway today is a cloudy day so what could be better then posting something about our adventures concerning work items and customized process templates. When we first decided to adopt Team System as our source control and collaboration system we decided to move ahead quickly and just implement the source control parts and deal with the rest at a later date.

Boy was this a misstake, if you intend to not use the default process templates based upon MSF you must spend some time thinking through what you want to change since in version 1 of TFS there is no easy way of reversing your choices once you've created your team project.

I'll describe a way to recreate the WIT database for your team project without loosing your source control data, but remember that this solution is not for the faint of heart :) and as someone told me:

You should be clear that any messing around with TFS at that level is inherently complex and error prone (and not recommended :))


Well with that out of the way here are the documentation you need to have read through and made certain it works on your installation of Team System before proceeding:

How to: Back Up a Team Foundation Server

How to: Restore Team Foundation Server Data

Also I recommend that you read about and perform a move of your TFS so you got experience in disaster recovery in case anything goes awry:

How to: Move Your Team Foundation Server from One Environment to Another

Well that should be enough with the saftey stuff in the next post I'll explain how to actually perform the magic...

Friday, April 6, 2007

Some usefull links when dealing with notifications in TFS

I've been working with TFS Notification Services lately and figured I'd post the links I've found usefull when trying to get this to work the way I want. The first place to look should be "Filtering Team Foundation Server Events" in the MSDN documentation

Here comes a collection of good to have links on the subject, enjoy:

Naren Datha (Microsoft)
FAQ on VSTS subscriptions and common problems

Jeff Atwood (Vertigo)
Subscribing to Team Foundation Server Events

Howard van Rooijen (Conchango)
Team Foundation Server Notification Web Services: Visual Studio 2005 Project Template

Mathias Olausson (Callista Knowledgebase)
Using BisSubscribe.exe for Team Foundation Server notifications

Subodh Sohoni as SEED InfoTech
Articles on Visual Studio Team System (VSTS)

The order in your files, matters when merging...

This post is just some basics on how to behave well when dealing with merging changes from different branches.

A rather common scenario is to have a main trunk and then branch of a maintenance version and a production release and a ongoing project branch. When dealing with a structure like this there tend to be alot of different people involved and all that goes along with that.

So why does the order in your files matter then? Say for instance you have the following class:

    public class MyClass
    {
        public MyClass()
        {
        }

        public void DoWork()
        {
        }
    }


Then you find a bug in you production code which you have to correct asap and in the process needs to refactor the code for some reason ending up adding a new method to the class. Now our class looks like this in the production branch:

    public class MyClass
    {
        public MyClass()
        {
        }

        public void DoWork()
        {
        }

        public void OurNeatNewBugfixMethod()
        {
        }
    }


Then your people working in maintenance (maybe the same person that fixed the bug in the first place) have no patience to wait for the regular forward / reverse integration cycle between the branches and makes the correction in the maintenance branch as well. So far there is no problems, but what if someone else has added functions in the maintenance branch. No problems well just add the function last right? And the result would look like this:

    public class MyClass
    {
        public MyClass()
        {
        }

        public void DoWork()
        {
        }

        public void DoMoreWork()
        {
        }

        public void OurNeatNewBugfixMethod()
        {
        }
    }


So what's the deal? Why is this a problem? Well now the day comes when we do our normal forward / reverse integration cycle and the merge detects changes in the file in both you branches. If you as lucky the file in question is a small one like this example and you'll get a merge conflict so you can catch it right away. However real life tends to be less compliant and you'll most likely have a large file and the problem code will not lie within the same block and thus slip through with out any conflict. The resulting file would look like this:

    public class MyClass
    {
        public MyClass()
        {
        }

        public void DoWork()
        {
        }

        public void OurNeatNewBugfixMethod()
        {
        }

        public void DoMoreWork()
        {
        }

        public void OurNeatNewBugfixMethod()
        {
        }
    }


So the moral of the story is that if you need to take shortcuts in your forward / reverse integration cycles make sure that you place the code in the exact same place in both branches and you'll save your self some problems with failing builds.

If you are curious on what the heck I'm talking about when I mention forward and reverse integration check out my post on branching guidelines for TFS.

Thursday, April 5, 2007

BisSubscribe and none evaluating filter expressions

After pulling my hair and screaming in agony over the darn filter property of TFS notifications I finally managed to figure it out :)

These examples works:

bissubscribe.exe /eventType CheckinEvent /address some@somewhere.com /deliveryType EmailHtml /server mytfsserver


bissubscribe.exe /eventType CheckinEvent /address some@somewhere.com /deliveryType EmailHtml /server http://mytfsserver:8080

bissubscribe.exe /eventType CheckinEvent /address some@somewhere.com /deliveryType EmailHtml /server http://mytfsserver:8080 /filter "TeamProject = MyProject"

This one however does not work:

bissubscribe.exe /eventType CheckinEvent /address some@somewhere.com /deliveryType EmailHtml /server mytfsserver /filter "TeamProject = MyProject"

Since all commands will execute with no errors resulting in a subscription in the TfsIntegration.tbl_subscription one easily gets fooled into thinking it should work but in the case of the fourth command nothing will happen.

The reason for this is that the /server switch of bissubscribe requires a fully qualified url address to your TFS server to function properly but only if you specify a filter with the /filter switch.

Hopefully Microsoft will add some validation on this switch in the future since it's one of thoose things that are hard to spot when no errors are generated (when glancing over it you mostlikely will only register the server name as its correctness).

Tuesday, April 3, 2007

The old new thing a good dose of windows nostalgia and more


The Old New Thing: Practical Development Throughout the Evolution of Windows by Raymond Chen

I recently finished reading the above book and I found it to be a very entertaining read, it contains everything you wanted to know about windows and it inner quirks. Much of the information is explanatory information on why windows is behaving in as it does in regards to backwards compatibility, but you will also find many good tips on how to write better applications for windows in general.



The middle part of the book reminded me of the good old days reading Charles Petzold's book Programming Windows ... which in turn leads to another book (by none other that Charles Petzold) for people who like to read about historical stuff and computers.

Code: The Hidden Language of Computer Hardware and Software by Charles Petzold

Friday, March 30, 2007

Unit testing for the masses

Naysawn Naderi announce earlier this week that Microsoft intends to release their unit test framework in the professional version of Visual Studio as well starting with the Orcas release. You can read more about it in his post Unit Testing Trickling into Pro!

He also asks for feedback on what else should go into the professional version so take the opportunity to comment on his post with some feedback. Hopefully this will end in a complete package including test management and code coverage trickeling down.

Thursday, March 29, 2007

Where did my changes go? The black hole of merging...

Lately we have had some problems with files disappearing from our projects or even projects from our solutions when doing integration between our main trunk and its child branches.

Since this was causing a bit of an issue when it comes to trusting Team System to handle merges correctly I did some investigation. The conclusion I came to was that it's not a bug (as I suspected). Although since we had problems with it I decided to post about it and maybe spare someone the trouble of having to figure out why it happens.

The problem arises when you have the following chain of events:

1, Make an addition to your project file in your main trunk.
2, Make an addition to your project file in your branch.
3, Perform a merge of the changes in the main trunk into the branch.
4, Resolve the conflict by preserving target changes.
5, Make an additional change to the project file in the main trunk.
6, Perform a merge of the changes in the main trunk into the branch.

What will happen is that the second merge will happily overwrite the changes made in the branch since there are no conflicting changes (remember we resolved the first conflict by ignoring the changes from the main trunk) it will simply merge the changes which results in a copy from source since we have no conflict between the files in the merge history.

There is not much to do about this since the behaviour is by design and the only way to prevent this from happening would be to always do a content compare of a file before actually performing the merge.

So the moral of the story is that if your resolving a conflict by choosing keep target you have to really know why your doing it.

Monday, March 26, 2007

TeamPlain will become Microsoft Visual Studio Team System Web Access

Today Microsoft announce it's acquisition of Teamplain a really great web frontend for Team System. This fits very nicely in to the overall solution since there are alot of people in you average mid to large size project that aren't comfortable in the Visual Studio IDE.

If you have a proper TFS server CAL you can download the v1.0 of here and start using it today.

We'll see it fully integrated into the "Orcas" release of Visual Studio 2005 but a interim release will be release as a VSTS Power Tool. Read more on Brian Harry's blog.

For more details on the acquisition go to the official press release from Microsoft.

Friday, March 23, 2007

Branching guidelines for TFS

Well spring has finally come to Sweden (which makes it even harder to find the time actually sit down a do som blogging) the weather today has been absolutely fantastic.

Anyway, Microsoft recently published a document on codeplex (kind of an odd distribution channel) which had been very useful to have when we setup shop with team system. There are alot of issues that needs to be considered and weighed when implementing a source control system in your development process.

So go ahead and download a copy of Team Foundation Server Branching Guidance.

I also though I'd take the opportunity to write down some other useful links when we are on the subject of branching and merging. Maybe someone will be spared the work of assembling the information...

Chris Birmele wrote a good whitepaper (it's mentioned in the guidance document aswell) Branching and Merging Primer which gives you a good start if you are new to the concepts.

Steve St Jean wrote an excellent document on the migration from VSS to TFS which you should read and consider to use (I'll save you the trouble of compiling your own for you developer teams) From VSS to TFS.

If you are like me and like to know the inner workings of things you should check out the writings of Eric Sink Source Control HOWTO there is alot of food for thought in them when it comes to the basics of source control.

Chuck Walrad & Darrel Storm wrote a very good piece on branching models and how to use them The importance of branching models in SCM

Brian Harry blogged about how they have organised themselves at Microsoft and the type of branching models the apply Branch structure in Developer Division at Microsoft

Last but not least you need to check out the postings on the subject of branching and merging by Mitch Denny he has written alot about this which I encourage you to read:

      The Terminology of Branching
      Concurrent Development with Branching
      Reducing Source File Contention with Branching
      Implementing Quality Gates with Version Control

If you haven't already done so you should probably read the following book by Vincent Maraia, the book is a goldmine of information based practical experience: The Build Master: Microsoft's Software Configuration Management Best Practices

Thursday, March 8, 2007

Creating lists based on output from actions in your build script

I'm being haunted by the blog police at work so I figure I'd post something instead of watching the telly today...

Sometimes when you create builds scripts for MSBuild you need to create collections based on the result of other actions in the script (for example after retrieving the latest files from source control or the output from a compilation). The problem is that it will not work when using wildcards since the expansion of the wildcards is done upfront before actually running the build script, so if your depending on the result from a get from source control for instance the first time you run your script the collection will be empty (since we have not yet retrieved the files) and ever execution after that will be based on the previous executions result (that is the files retrieved from source control the latest run).

To get past this you'll either need to create a target that contains a <CreateItem> action with the path to the files in question then this will be evaluated during the execution of the script. But what if I want to create a reusable target that can be driven by creating an <ItemGroup> what then?

I've created a target that you can use to do this which is based on the concept of using escaped asterisks (%2a) when specifying the path to the files in question it looks like this:

<ItemGroup>
   <!--Dynamic List of Typelibraries-->
   <FileList Include="$(SolutionRoot)\Typelibraries\%2a%2a\%2a.tlb">
      <OutDir>MyFlattenOutput\</OutDir>
   </FileList>
</ItemGroup>

<Target Name="AfterGet">
   <CallTarget Targets ="CopyFiles"/>
</Target>

<Target Name="CopyFiles">
   <Message Text="Copying Files" />

   <!—Create list of files-->
   <CreateItem Include="%(FileList.Identity)"
                            AdditionalMetadata="OutDir=%(FileList.OutDir)">
      <Output ItemName="ExpandedFileList" TaskParameter="Include"/>
   </CreateItem>

   <Copy SourceFiles="@(ExpandedFileList)"
                DestinationFiles="@(ExpandedFileList ->'$(DropLocation)\$(BuildNumber)\%(OutDir)%(RecursiveDir)\%(Filename)%(Extension)')"
   ContinueOnError="True" />
</Target>

Well that's all there is to it hope someone out there will have some use for this...

Sunday, March 4, 2007

Introductions...

The last six months or so I have started to realize the necessity to share information when working with technology. Many headaches have been solved browsing through various blogs, so I figured it was time to give some back...

My main focus will be on architecture and the development process (although I might throw in a nugget from time to time dealing with day to day development tasks) and the occasional book review.