Automating Web Site Builds with Team Build

Using Team Build to Build an ASP.NET Web Site

So – you’re a web guy – good for you! – no – really – I mean it.  You like ASP.NET – Excellent.  You heard about this Team System hubbub and think to yourself “nice…” and dive into the automated build world that is provided with Team Foundation Server.  You follow the rules by creating a Solution Structure that contains a web site – you add it to Team System’s rocking new source code repository and jump into the Team Build Wizard to go and create a new automated build (after you install Team Build on a separate computer of course).  You run through the create build definition wizard – and you can literally hear the villagers dancing in the streets!  You go and kick off the build through the Visual Studio Team Explorer – and… it doesn’t work.

Bugger.

Very common problem apparently.  First of all, check out the properties of your solution file…specifically Configuration Properties->Configuration.  Here you will see a list of your projects, their configurations and platform.  Notice how your web app’s platform is .NET.  Hmm… did you even see that option when setting up the automated build?  Nope – ya didn’t.  You only had the ability to select Debug and Release and to select from a platform list that included the Itanium, but not .NET.

So, is there a solution?  Sure… I guess.  What I’ve done to fix the problem is to remove the following section(s) from the TFSBuild.proj file that essentially helps to define the Build definition (this is stored in source control under “Team Build Types\><NAMEOFYOURBUILD>” in case you were wondering).

    <ConfigurationToBuild Include="Debug|Any CPU">

      <FlavorToBuild>Debug</FlavorToBuild>

      <PlatformToBuild>Any CPU</PlatformToBuild>

    </ConfigurationToBuild>

This will force the Mr. Big Build to use the configuration defined in the solution file.  You can alternatively change that section to the following:

    <ConfigurationToBuild Include="Debug|Any CPU">

      <FlavorToBuild>Debug</FlavorToBuild>

      <PlatformToBuild>.NET</PlatformToBuild>

    </ConfigurationToBuild>

So, this get’s better – suppose you have a solution that has a web site as well as a bunch of libraries.  Well, in this case you have a mixed set of configurations and platform targets don’t ya…

Try this:

    <ConfigurationToBuild Include="Debug|Mixed Platforms">

      <FlavorToBuild>Debug</FlavorToBuild>

      <PlatformToBuild>Mixed Platforms</PlatformToBuild>

    </ConfigurationToBuild>

In truth, these options should appear in the Team Build creation wizard.. but for some reason that’s not always the case.  Also, don’t discount the importance of the solution structure and your web site – you need to ensure your website is contained within the solution structure.

1 Comment

Comments have been disabled for this content.