Friday, May 27, 2011

Next UK ALM User Group Meeting June 8th 2011

Register here: http://uk-alm-june-2011.eventbrite.com/

I always find these meetings really interesting. So you there!Link

Anyone actually using Workflow for builds in Team Build 2010

I have been using TFS 2010 since the early releases and I am very impressed with its features, some of which I have blogged about here: http://www.simonrhart.com/search/label/TFS

But whenever I have tried using the new Team Build 2010 Build Template Workflow (which is based on MSBuild under the covers) I find it more difficult to navigate and manage. Not to mention there are not many activities around for things like, running StyleCop rules, creating IIS virtual directories, managing service accounts etc.

So the real question is, why would I use Workflow over pure MSBuild.

I am very impressed with the MSBuild Extension Pack that contains many tasks that covers the things I mentioned above and more. I also know there is a MSBuild activity which means you can make use of the MSBuild Extension Pack from within Workflow but this kind of defeats the purpose of using Workflow in the first place.

I also often want the ability to run a build locally before check-in. This build is normally a nightly build which not only compiles code, runs unit tests and acceptance tests etc but it sets up the environment. i.e. if you have a BizTalk solution and you need to deploy the bindings, schema's, maps etc the BTDF can be used to help facilitate this easily. Well when I say easily there is a bit of work to get this to work with Team Build that I will blog about soon...

I know in Team Build 2010 there is the new gated-check in feature that shelves changes, runs a build against the shelved changes then merges with the branch in question if successful. This is great but only half the story. On every get-latest I want the developers machine to be setup and be able to run the latest code. If another developer has added a WCF service with a new app pool or added a receive port, this script needs to take care of all that without each developer even thinking about it.

With the Workflow build templates, there is no way to run those builds locally. The gated-check in is an additional feature that addresses the problem of the developer not running a local build otherwise known as a "buddy build" before he/she checks in to prevent build failures.

To date, I use the "Upgrade Template" in Team Build 2010. I was wondering if anyone was actually using the Default Templates based on pure Workflow?

Sunday, May 22, 2011

Microsoft.BizTalk.TestTools.Mapper.TestableMapBase erroring in Team Build

Have you recently attempted to use the Microsoft.BizTalk.TestTools.Mapper.TestableMapBase (This class enables you to test BizTalk maps programmatically through MSTest or NUnit) on the build server as a CI process or otherwise through some sort of test harness, if so, you might have received the following error:

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.BizTalk.TOM, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

This was happening in a new development environment during the execution of MSTest unit tests against BizTalk 2010 Developer Edition and a Team Foundation 2010 build during a CI build process.

After searching around and reading various blog posts, I couldn't find the solution other than to repair BizTalk. This sounded rather drastic to fix a simple error. So I then decided to do the normal thing a .NET developer would do and check the GAC for the file Microsoft.BizTalk.TOM. I failed to find it so I guess the BizTalk installation must have failed somewhere, as I didn't install BizTalk on that machine it's hard to know.

So I then decided to GAC the file. Looking for GACUTIL.exe, I soon realised and remembered that GACUTIL is not supplied with the .NET Framework. As this was a build server, I didn't have Visual Studio installed. Then I remembered I installed the Windows Server SDK v6.1 on this machine so that I could actually build code and run tests (due to various build targets that comes with the Windows Server SDK). When you install the Windows SDK it comes with a CMD.cmd file and GACUTIL.exe (among other things) that sets up the environment ready to use the various tools.

So to fix this missing assembly issue:

1. if you don't have the Windows SDK installed install it (latest version at the time of writing is
v6.1)
2. Once the SDK is installed, run this: C:\Windows\System32\cmd.exe /E:ON /V:ON /T:0E /K "D:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd" This is assuming you have installed the SDK on a drive D.
3. Run the following command: GACUTIL C:\Program Files (x86)\Common Files\Microsoft BizTalk\Microsoft.BizTalk.TOM.dll -i

Queue a build, or attempt to run the app using the map test class and all should be well (unless you have other issues!)

Administrative access in Team Build 2010 for creating IIS AppPools etc




I have recently been using the MSBuild Extension Pack over on codeplex available here: http://msbuildextensionpack.codeplex.com/. I came across an issue (build failing) recently where I was trying to write DNS entries to the local HOSTS file and also attempting to create IIS Application Pools and users etc using various tasks provided by the MSBuild Extension Pack.

I have separate build servers 1 for CI and 1 for Integration both of which run Team Build 2010 and the build service runs under a domain user account.

Of course attempting to do the above things require local administrative access to the machine on which you attemp to create App Pools, add DNS entries etc. So I fired up Computer Management and added the TFSBUILD service account to the local Administrators group.

After doing this, I queued a build and it still failed. After looking through the logs in more detail and checking Team Build configuration, all looked correct. I then logged onto the machine using the TFSBUILD account and attempted to perform an administrative action like edit the HOSTS file which I was successfully able to do. I also looked in the Event Log for any errors that might give me a clue as to why it was failing, but nothing there.

In the end I restarted the build controller, queued a build and it worked!

So I'm guessing that security permissions are cached in Team Build.

For information purposes, I'm running Team Build on separate Windows Server 2008 R2 machines from the databases and App Tiers. I'm also using the Upgrade Template so using core MSBuild 4.0 - not Workflow to execute the builds.