January 2009 Archives

My friend and fellow Team System MVP, Neno Loje, has been on a blogging frenzy this year. Recently he has published a handy Visual Studio template if you do a lot of playing with Team Foundation Server API calls (as I do), or if you are trying to play with an TFS API example that you have found on the net but are having trouble finding the assemblies required to use it.

image

Go check out Neno’s post now if you are serious about TFS API development, and while you are at it be sure to subscribe to his blog.

When you create a new build definition in Team Foundation Server, you get to define how the workspace looks for the build.  By default this includes the ENTIRE team project.  While this usually always works, it is nearly always not what you want.

Build Definition = What, How and When

You can think of a build definition as you telling TFS "What, How and When" you want to build something.  The "What" is covered by the workspace template.  The "How" is covered by the Project File (the TFSBuild.proj file in TFS2005 or TFS2008 or the WF Process in TFS2010).  The "When" is the trigger.

If you think about it, the "What" is pretty important. Not only does it include the files that are downloaded for your build, it also informs the trigger.  If you have set a build to run on every check-in then it needs to know what you are building to determine if the check-in applies to it.  If you set your "What" to be too broad then you will build when you don't need to.  If you set your "What" too narrow, then your build will not be triggered by files that impact the build.  This will become even more important when Gated Check-ins come along in TFS 2010, but doing this now will dramatically speed up the performance of your builds and mean that CI builds are done when something that you care about changes.  Let's take a look at the workspace template definition screen as it gets populated by default:

Build Definition - Wallboard

Notice that we have the server path of the Team Project mapped to the $(SourceDir).  You can click on either of these paths and edit them.  Most of the time, you just want to edit the server path to restrict it to the root of the project that you want to build such as:

Build Definition - Wallboard (2)

If you only learn one thing from this tip, then the above is all you really need to know to make your experience with Team Foundation Build much nicer.  However, the working folder mappings can get quite complicated if you want to.

Excluding Certain Folders from the Build.

Now, lets take a different scenario. Suppose you are working on a web site. You have your graphic designers also checking in their digital assets into the $/AdventureWorks/main/dotnet/Wallboard/assets folder in the project but you don't want to create a new build when they check in their huge Photoshop files - especially as the .psd files are not actually used in the website, just the .gif and .jpg files that they generate from the .psd's.  In this case you can use a cloaked working folder mapping to tell TFS to ignore those files from the trigger and when downloading source before a build.

Build Definition - Wallboard (3)

Building from Multiple Places

Another scenario you might be faced with is building two things at the same time from different parts of your source tree.  That's easy - simply add another Active working folder mapping and adjust your LocalFolder mappings accordingly:

Build Definition - Wallboard (4)

What Variables are Allowed?

In the Local Folder mapping you can hard code paths, but it isn't recommended.  There are two variables that can be used, $(SourceDir) and $(BuildDir). BuildDir is the build directory as defined in the build agent definition. $(SourceDir) is usually $(BuildDir)\Sources.  The "Sources" part is actually not hard-coded and can be modified by editing the TfsBuildServer.exe.config on the build agent machine if you wanted.  For example if you changed

<add key="SourcesSubdirectory" value="Sources" />

to be

<add key="SourcesSubdirectory" value="s" />

then $(SourceDir) would get expanded to $(BuildDir)\s on the build agent.  Therefore, $(SourceDir) is by far the most useful option.  That said - if you wanted to make your build to be triggered to changed to the TFSBuild.proj file, but for backwards compatibility with VS2005 you had your build configuration folder in the default "$/TeamProject/TeamBuildTypes" folder instead of the project's branch (which would be my recommended location) then you could use the $(BuildDir) variable to trick TeamBuild into triggering a build when the TFSBuild.proj file were modified by setting your build configuration as follows:

Build Definition - Wallboard (5)

By setting the server path to "$/AdventureWorks/TeamBuildTypes/Wallboard CI/*" and the local path to "$(BuildDir)\temp" we are telling Team Build to include the files in the root of the build configuration folder but to place them outside of the SourceDir so that they do not confuse our build process.  Note that in 2008 working folder mappings because a lot more flexible, so you can now map the root level of a folder using the Asterisk (*) wildcard and you can also map individual files as active or cloaked working folder mappings if you want to include or exclude individual files.

In summary, spend some time to think about what you want included in your build and do not be afraid to have your version control repository organized in a way that makes building it simple. One of the biggest problems when people move to a new version control system is that they inherit the repository layout from their old system rather than sitting down and thinking about what makes most sense with the new features or restrictions of the system that you are moving to.  Happy Building!

This icon means I am serious - you really want this security patch We get so used to the words “Important Security Update” that it is easy to let messages like this one pass you by. However if you have Team System Web Access (TSWA) installed – particularly if you have it on a machine that can be accessed over the internet - then you really want to upgrade it to the latest version available here:

http://go.microsoft.com/fwlink/?LinkID=136577

This release includes an important security fix that you want to have installed.  It is a full release so you have to uninstall web access and then install this version.  A KB article on the issue is due out soon, keep an eye on Hakan’s blog for more details.

DDD Coming to Belfast

image After the highly successful Developer Developer Developer event in Galway last year, this time it is moving north to my neck of the woods – Belfast. For those not familiar with the DDD events they are run on a Saturday and everyone gets together in this great free event run for the community, by the community.  Session submissions are an open process – and session can be submitted by anyone and the sessions that are held are the ones with most community interest.

There are no Microsoft speakers present, just speakers from the .NET developer community – although I hear on the grapevine that our local Irish DPE’s will be hanging around the crowd to soak up the atmosphere and chat to people that want to the idea behind the get together is that we all get to share in our real world experiences and knowledge from working down at the code face.

Best of all the event is FREE, with all the speakers volunteering and facilities kindly provided by the sponsors.  Not only can you learn about some of the technologies that you would have to pay to go learn about at a TechEd or PDC - the DDD events are a really great way of meeting interested and interesting people locally and making some great contacts.

So – if you are around the area then I encourage you to join me on April 4th in Belfast.  If you fancy giving a talk then head over to the site quick and submit your talk idea now.  Alternatively, if there is a topic that you would love to see covered then suggest it on the site.

Find out more at: http://developerdeveloperdeveloper.com/belfast/

What's New with Team Foundation Server Slides Tonight at NIMTUG I'm going to be giving a talk to get everyone up to speed with the latest developments in the Team Foundation Server world.  We are going to review what came along in 2008, talk about the new bits in Service Pack 1 and the latest power tools release.  We are then going to spend the second half of the talk looking into the future and playing with the latest CTP of Team Foundation Server 2010.

Slides for the session are available here:

Links to resources mentioned in the talk:

If you are in the area then please register and drop along to the Wellington Park Hotel at 19.30.  As usual I'll be hanging around in the bar afterwards if you want to catch up and have a chat.

Freezing Time in VMWare

tfs2010_on_mac One of the many pains of working with the October 2008 CTP of VS2010 (aka Rosario) is that on top of everything else, it actually timebombed on January 1st 2009. This means that you have to run the virtual machine disconnected from the clock. Unsurprisingly all of the virtualization packages on the market try their hardest to do you doing crazy things like that.  For a start, both VMWare and Virtual PC will set the CMOS clock date/time to be the time that you created / converted the machine.  This means you have to be lightening fast on your F2 button to get into the BIOS setup screen to set the clock back.

You also need to tell the virtual machine to disable clock synchronization.  Brian Keller has a blog post on how to do this with Microsoft Virtual PC.  However, I needed to figure it out on VMWare Fusion. Luckily the following PDF from VMWare came to my rescue (http://www.vmware.com/pdf/vmware_timekeeping.pdf).  The document is a little painful to read through, but basically all you need to do is open up the .vmx file in TextEdit and add the following entries:

tools.syncTime = FALSE
time.synchronize.continue = FALSE
time.synchronize.restore = FALSE
time.synchronize.resume.disk = FALSE
time.synchronize.shrink = FALSE
time.synchronize.tools.startup = FALSE

Two of these caused me problems, first tool.syncTime was already set to false (likely because the Virtual PC image I converted already had time sync disabled).  Next was “time.synchronize.tools.startup = FALSE”.  This stops the VMWare tools from setting the guest OS time on OS startup and was missing from all the other posts I saw online about dealing with this issue.

From time to time I hear from people who dislike the automatic check out behaviour common with TFS.  One of the great things about TFS is the the pending changes list that shows you the files you have currently checked out and allows you to easily undo any un-intentional check outs.  While I personally find the auto-checkout features a productivity boon - like most things there is a preference that you can use to adjust the default behaviour if you find it causes problems with the way you like to work.

In Visual Studio 2008 (with the Team Explorer 2008 installed), go to Tools, Options, Source Control, Environment and change the Checked-in items for Saving and Editing to "Prompt for check out" rather than the default which is "Check out automatically".

Options dialog of Visual Studio showing Source Control, Environment settings

This will then prompt you before the automatic checkout occurs and give you the opportunity to cancel if you wish.

In Eclipse with Teamprise installed, go to Window, Preferences (or Eclipse, Preferences on the Mac) and then Teamprise, Source Control to enable prompting before check out.

Teamprise Source Control preferences

That said, I would strongly encourage you to stick with the defaults and have Multiple check outs enabled in TFS for your Team Project and also keep the Pending Changes view on screen (in VS View, Other Windows, Pending Changes or in Eclipse Window, Show View, Other, Teamprise, Pending Changes).  That way you can always see what you have checked out at any time and immediately undo any check-outs that you no longer need.

The Year Planner Shuffle

| 1 Comment

2009 Year Planner Today is the first day of the new year in the office and so it is time for me to do the dance that I always do after Auld Lang Syne, and that is the Annual Year Planner Shuffle.  This morning I threw away the 2008 year planner, moved the 2009 one up and printed out a new 2010 sheer.

While I have my Outlook / Google / Apple iCal calendars all synchronized and duplicated onto my mobile devices, I also love to have a simple year planner printed on a sheet of paper and up on the wall next to my desk for quick reference. I have the current year and the following year on my wall and fill it out with key dates as I know about them.  Things like public holidays, conferences, release dates etc.  Anything that I would want to know about when taking a quick look out in the future to do some long term planning.

My favourite year planner comes out of (I think) an Adobe Pagemaker template.  I don’t have Adobe Pagemaker and so at the start a year I will search for “2010 year planner pmd” or whatever the year happens to be and generally I will find a copy of a PDF that some kind soul has published on the internet.  I’ve leached the past few years (since 2007 I think) from some kind person at the University of Wolverhampton.

If you are following my lead and want to fill out a planner for this year then Mary Jo Foley has just published a list of all the Microsoft related events/conferences of 2009.  Many of the items on Mary’s list with the addition EclipseConEclipse 3.5 Release Milestones and the Northern Ireland Public Holidays make up most of the key public dates on my planner for 2009.

Happy New Year to everyone.  What with Visual Studio Team System 2010 development progressing along with Windows 7 and Eclipse 3.5 it promises to be another interesting and busy year ahead.

Archives

Creative Commons License
This blog is licensed under a Creative Commons License.