Geeks With Blogs

News Hi, my name is Vincent Grondin and I'm a senior consultant at Fujitsu, a consulting firm in Montreal, Québec. I'm starting that blog to share some of my thoughts and knowledge on .NET architectures and code. Being a consultant in the .NET world I come across many different things. Some good, some bad and others that are worth a blog post here whether they be good, or hmmm... shall I say, less good :) I hope you enjoy yourself while learning new stuff. Feel free to leave a comment or contact me anytime.

Vincent Grondin

Running unit tests after a successful build with Team Build 2008 can be a tricky thing....  especially when you test your localization using satellite assemblies.  Out of the box this cannot be done in Team Build 2008, you need to tweak some files to get it to work properly, but which ones??!!  This article should help you solve similar problems in your build environment.  I had this problem where all localization tests would work on my developer’s workstations but would systematically fail on the build server...  and I could see why!  The localization folder (like “en-CA” for instance) was not copied to the “Out” directory structure of Team Build 2008!!  Here’s the work around...

The first thing I was confronted to when trying to run my unit tests with Team Build 2008 is that it would not use my “.testrunconfig” file that Visual Studio 2008 uses when running my unit tests locally.  How awkward?  My teammate and I started looking for answers on the web and he found out we needed to “tell” Team Build 2008 we wanted to use a different test configuration file than the default one.  I’m glad you found that one Robert.  This can be done by editing the “.proj” file of your solution under source control.  In your Visual Studio 2008, in the team explorer tree, double click on the “Source Control” item.  This should send you to the root of your solution in TFS 2008.  Then you need to locate the “.proj” file that you probably created a while back when creating the build definition for your project.  By default, this file resides in :

 “YourTFSTeamProjectName\TeamBuildTypes\YourBuildDefinitonName”

and is called “TFSBuild.proj”.  This is an XML file (MSBuild) used by Team Build 2008 to perform your build.  Open the file in your XML editor and locate the “PropertyGroup” node.  Inside this node, add the following node “<RunConfigFile> </RunConfigFile>”.  Inside this node you need to point to the location in your source control where the “.testrunconfig” file can be found.  Use the $(SolutionRoot) tag and then add your folder like this:

 $(SolutionRoot)\YourFolder\YourTestConfigFileName.testrunconfig

Alright, but we’re not done yet.  What you just did is tell Team Build 2008 what file to use for the build on the server but you still need to tell him to copy your satellite assemblies, remember?  Open your “.testrunconfig” file in an XML editor.  Inside the “TestRunConfiguration” node, locate the “Deployment” node or add one if there is none.  Inside this node, add the “DeploymentItem” node and fill the “filename” and “outputDirectory” parameters of the node.  Here’s what my “Deployment” node looks like for deploying resources in the “English – Canada” locale:

<Deployment>

    <DeploymentItem filename="en-CA" outputDirectory="en-CA" />

</Deployment>

Save the file and you’re done.  If you have trouble running this procedure, do not hesitate to reply or contact me I’ll be glad to help you out!  Happy TFS-ing all!

Posted on Saturday, September 5, 2009 9:21 PM | Back to top


Comments on this post: Team Build 2008 and Satellite Assemblies

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Vincent Grondin | Powered by: GeeksWithBlogs.net