<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>No Free Time &#187; nant</title>
	<atom:link href="http://andrewmyhre.wordpress.com/category/nant/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewmyhre.wordpress.com</link>
	<description>Because my therapist says I need to let things out</description>
	<lastBuildDate>Fri, 04 Dec 2009 12:05:33 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='andrewmyhre.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/b012d8af26af279e8b78dea60a545c86?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>No Free Time &#187; nant</title>
		<link>http://andrewmyhre.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://andrewmyhre.wordpress.com/osd.xml" title="No Free Time" />
		<item>
		<title>Build Helpers</title>
		<link>http://andrewmyhre.wordpress.com/2008/02/26/build-helpers/</link>
		<comments>http://andrewmyhre.wordpress.com/2008/02/26/build-helpers/#comments</comments>
		<pubDate>Tue, 26 Feb 2008 08:08:12 +0000</pubDate>
		<dc:creator>Andrew Myhre</dc:creator>
				<category><![CDATA[CI]]></category>
		<category><![CDATA[nant]]></category>
		<category><![CDATA[Continuous Integration]]></category>

		<guid isPermaLink="false">http://andrewmyhre.wordpress.com/?p=21</guid>
		<description><![CDATA[I want to share the build script helpers I've been working on, which I think will save me loads of setup time in the future. Today: compilation.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrewmyhre.wordpress.com&blog=2776051&post=21&subd=andrewmyhre&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve made a couple of build helper files which may come in handy. They cover compilation, testing and deployment, and hopefully can be reused between projects with minimal need to be rewritten. I&#8217;ll share the compilation one today.</p>
<h2>Compilation Build Scripts</h2>
<p>As background my folder structure looks like this:</p>
<p>/Solution/ClassLibrary1<br />
/Solution/ClassLibrary2<br />
/Solution/Website1<br />
/Solution/Resources<br />
/Solution/Build<br />
/Solution/Build/bin<br />
/Solution/Build/src<br />
/Solution/Build/testlib<br />
/Solution/Build/deploy</p>
<p><b>Resources</b> is where everything like NAnt, MBUnit, log4net, NCover etc all reside. Various things happen within the <b>Build</b> folder: <b>src</b> is where all projects are copied into before being compiled, <b>bin</b> is where each compiled assembly is placed for easy reference for other assemblies (e.g: where ClassLibrary2 depends on ClassLibrary1), <b>testlib</b> is where all test assemblies are compiled and run, and <b>deploy</b> is where our final compilation will end up.</p>
<p>The reason each assembly is copied into the src folder prior to compilation is so that we can do tricky things like substituting *.config and AssemblyInfo.cs files, as you&#8217;ll see below.</p>
<p>The build file starts this way:</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    1</span> <span style="color:blue;">&lt;?</span><span style="color:#a31515;">xml</span><span style="color:blue;"> </span><span style="color:red;">version</span><span style="color:blue;">=</span>"<span style="color:blue;">1.0</span>"<span style="color:blue;">?&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    2</span> <span style="color:blue;">&lt;!--</span><span style="color:green;">EXTERNAL_PROPERTIES: output.dir;AssemblyName;debug;assembly.label</span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    3</span> <span style="color:blue;">&lt;</span><span style="color:#a31515;">project</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">general compilation</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    4</span> <span style="color:blue;">  &lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">clean</span>"<span style="color:blue;"> &gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    5</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">delete</span><span style="color:blue;"> </span><span style="color:red;">dir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}</span>"<span style="color:blue;">/&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    6</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    7</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    8</span> <span style="color:blue;">  &lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">init</span>"<span style="color:blue;"> </span><span style="color:red;">depends</span><span style="color:blue;">=</span>"<span style="color:blue;">clean</span>"<span style="color:blue;"> &gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    9</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">mkdir</span><span style="color:blue;"> </span><span style="color:red;">dir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   10</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">mkdir</span><span style="color:blue;"> </span><span style="color:red;">dir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}/bin</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   11</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>Straight forward. Note that the ${output.dir}, ${AssemblyName}, ${debug} and ${assembly.label} properties are expected to be set &#8211; these will be set from your calling build file. ${output.dir} can simply be &#8220;c:pathSolutionBuild&#8221;. ${AssemblyName} is just the name of the assembly you want to compile at that time.</p>
<p>Assembly compilation:</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   13</span> <span style="color:blue;">&lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">general.compile.assembly</span>"<span style="color:blue;"> </span><span style="color:red;">description</span><span style="color:blue;">=</span>"<span style="color:blue;">compiles a satellite assembly</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   14</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">*******************************</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   15</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">***COMPILING ${AssemblyName}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   16</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">***TO ${AssemblyOutputFolder}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   17</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">*******************************</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   18</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   19</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">delete</span><span style="color:blue;"> </span><span style="color:red;">dir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src${AssemblyName}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   20</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   21</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">copy</span><span style="color:blue;"> </span><span style="color:red;">todir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src</span>"<span style="color:blue;"> </span><span style="color:red;">flatten</span><span style="color:blue;">=</span>"<span style="color:blue;">false</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   22</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">fileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   23</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${AssemblyName}***.*</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   24</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">exclude</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${AssemblyName}bin</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   25</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">exclude</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${AssemblyName}config</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   26</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">exclude</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${AssemblyName}**AssemblyInfo.cs</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   27</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">fileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   28</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">copy</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   29</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   30</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">call</span><span style="color:blue;"> </span><span style="color:red;">target</span><span style="color:blue;">=</span>"<span style="color:blue;">general.labelassembly</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   31</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   32</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">csc</span><span style="color:blue;"> </span><span style="color:red;">target</span><span style="color:blue;">=</span>"<span style="color:blue;">library</span>"<span style="color:blue;"> </span><span style="color:red;">output</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}bin${AssemblyName}.dll</span>"<span style="color:blue;"> </span><span style="color:red;">debug</span><span style="color:blue;">=</span>"<span style="color:blue;">${debug}</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   33</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">sources</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   34</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src${AssemblyName}/**/*.cs</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   35</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">sources</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   36</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">references</span><span style="color:blue;"> </span><span style="color:red;">refid</span><span style="color:blue;">=</span>"<span style="color:blue;">assembly.resources</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   37</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">csc</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   38</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">copy</span><span style="color:blue;"> </span><span style="color:red;">file</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}bin${AssemblyName}.dll</span>"<span style="color:blue;"> </span><span style="color:red;">tofile</span><span style="color:blue;">=</span>"<span style="color:blue;">${AssemblyOutputFolder}${AssemblyName}.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   39</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>As the description says, this target compiles a satellite assembly, or class library. It first deletes the src folder (/Solution/Build/src/AssemblyName) before copying the latest source into it. Then it calls the &#8220;general.labelassembly&#8221; target, which we&#8217;ll see shortly. Finally it compiles all .cs files into a dll.</p>
<p>Note line 36, where the references tag uses assembly.resources. This is because you should call the target like this:</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    5</span> <span style="color:blue;">    &lt;!--</span><span style="color:green;"> Class Library </span><span style="color:blue;">1 --&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    6</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">property</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">AssemblyName</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"ClassLibrary1"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    7</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">assemblyfileset</span><span style="color:blue;"> </span><span style="color:red;">id</span><span style="color:blue;">=</span>"<span style="color:blue;">assembly.resources</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    8</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${resources.dir}/log4net.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">    9</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">assemblyfileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   10</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">call</span><span style="color:blue;"> </span><span style="color:red;">target</span><span style="color:blue;">=</span>"<span style="color:blue;">general.compile.assembly</span>"<span style="color:blue;"> /&gt;</span></pre>
</div>
<p>This way you only specify exactly what you need to in order to build the assembly.</p>
<p>Now, websites. First we need to prepare a few things:</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   41</span> <span style="color:blue;">&lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">prepare.web</span>"<span style="color:blue;"> &gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   42</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">mkdir</span><span style="color:blue;"> </span><span style="color:red;">dir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src${website.name}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   43</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">*******************************</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   44</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">***COMPILING ${website.name}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   45</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">*******************************</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   46</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   47</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">copy</span><span style="color:blue;"> </span><span style="color:red;">todir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src</span>"<span style="color:blue;"> </span><span style="color:red;">flatten</span><span style="color:blue;">=</span>"<span style="color:blue;">false</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   48</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">fileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   49</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${website.name}***.*</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   50</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">exclude</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${website.name}config</span>"<span style="color:blue;"> /&gt; &lt;!--</span><span style="color:green;"> this are where we put environment-specific config files </span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   51</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">exclude</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${website.name}bin*.*</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   52</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">exclude</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${website.name}web.config</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   53</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">fileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   54</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">copy</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   55</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">copy</span><span style="color:blue;"> </span><span style="color:red;">todir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src${website.name}bin</span>"<span style="color:blue;"> </span><span style="color:red;">flatten</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   56</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">fileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   57</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}bin*.*</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   58</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">fileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   59</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">copy</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   60</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">copy</span><span style="color:blue;"> </span><span style="color:red;">todir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src${website.name}bin</span>"<span style="color:blue;"> </span><span style="color:red;">flatten</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   61</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">fileset</span><span style="color:blue;"> </span><span style="color:red;">refid</span><span style="color:blue;">=</span>"<span style="color:blue;">website.resources</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   62</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">copy</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   63</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>Then we can compile the site itself. Note that we don&#8217;t copy the web.config over with the website. This is because I have a seperate target to copy a config file, replacing environment specific variables as it copies. I&#8217;ll come to that in a bit.</p>
<p>The next target is straightforward &#8211; compile the website to the /Build/Deploy/WebsiteName folder.</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   65</span> <span style="color:blue;">&lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">general.compile.website</span>"<span style="color:blue;"> </span><span style="color:red;">description</span><span style="color:blue;">=</span>"<span style="color:blue;">compiles a website</span>"<span style="color:blue;"> </span><span style="color:red;">depends</span><span style="color:blue;">=</span>"<span style="color:blue;">prepare.web</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   66</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">mkdir</span><span style="color:blue;"> </span><span style="color:red;">dir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}Deploy${website.name}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   67</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">exec</span><span style="color:blue;"> </span><span style="color:red;">program</span><span style="color:blue;">=</span>"<span style="color:blue;">aspnet_compiler.exe</span>"</pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   68</span> <span style="color:blue;">        </span><span style="color:red;">basedir</span><span style="color:blue;">=</span>"<span style="color:blue;">C:WINDOWSMicrosoft.NETFrameworkv2.0.50727</span>"</pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   69</span> <span style="color:blue;">        </span><span style="color:red;">workingdir</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}</span>"</pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   70</span> <span style="color:blue;">        </span><span style="color:red;">commandline</span><span style="color:blue;">=</span>"<span style="color:blue;">-u -v /${website.name} -p ${output.dir}src${website.name} ${output.dir}Deploy${website.name}</span>"<span style="color:blue;">  /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   71</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>Here&#8217;s a target used to copy a config file.</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   73</span> <span style="color:blue;">&lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">general.compile.website.copyconfig</span>"<span style="color:blue;"> </span><span style="color:red;">description</span><span style="color:blue;">=</span>"<span style="color:blue;">Copies an XML file to the website's web.config, replacing tokens as specific in fileset</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   74</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">copy</span><span style="color:blue;"> </span><span style="color:red;">file</span><span style="color:blue;">=</span>"<span style="color:blue;">${template.sourcefilename}</span>"<span style="color:blue;"> </span><span style="color:red;">tofile</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}Deploy${website.name}web.config</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   75</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">filterchain</span><span style="color:blue;"> </span><span style="color:red;">refid</span><span style="color:blue;">=</span>"<span style="color:blue;">config.settings</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   76</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">copy</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   77</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
</div>
<p>And finally the target to label the assembly.</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   79</span> <span style="color:blue;">  &lt;</span><span style="color:#a31515;">target</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">general.labelassembly</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   80</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">asminfo</span><span style="color:blue;"> </span><span style="color:red;">output</span><span style="color:blue;">=</span>"<span style="color:blue;">${output.dir}src${AssemblyName}AssemblyInfo.cs</span>"<span style="color:blue;"> </span><span style="color:red;">language</span><span style="color:blue;">=</span>"<span style="color:blue;">CSharp</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   81</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">imports</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   82</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">import</span><span style="color:blue;"> </span><span style="color:red;">namespace</span><span style="color:blue;">=</span>"<span style="color:blue;">System.EnterpriseServices</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   83</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">import</span><span style="color:blue;"> </span><span style="color:red;">namespace</span><span style="color:blue;">=</span>"<span style="color:blue;">System.Reflection</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   84</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">import</span><span style="color:blue;"> </span><span style="color:red;">namespace</span><span style="color:blue;">=</span>"<span style="color:blue;">System.Runtime.CompilerServices</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   85</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">imports</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   86</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">attributes</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   87</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">attribute</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>"<span style="color:blue;">AssemblyVersionAttribute</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:red;">"</span><span style="color:blue;">${assembly.label}</span><span style="color:red;">"</span>"<span style="color:blue;"> </span><span style="color:red;">asis</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   88</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">attribute</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>"<span style="color:blue;">AssemblyTitleAttribute</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:red;">"</span><span style="color:blue;">Canon Create</span><span style="color:red;">"</span>"<span style="color:blue;"> </span><span style="color:red;">asis</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   89</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">attribute</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>"<span style="color:blue;">AssemblyDescriptionAttribute</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:red;">"</span><span style="color:blue;">assembly for Canon Create</span><span style="color:red;">"</span>"<span style="color:blue;"> </span><span style="color:red;">asis</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   90</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">attribute</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>"<span style="color:blue;">AssemblyCopyrightAttribute</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:red;">"</span><span style="color:blue;">Copyright (c) 2008</span><span style="color:red;">"</span>"<span style="color:blue;"> </span><span style="color:red;">asis</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   91</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">attribute</span><span style="color:blue;"> </span><span style="color:red;">type</span><span style="color:blue;">=</span>"<span style="color:blue;">ApplicationNameAttribute</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:red;">"</span><span style="color:blue;">${AssemblyName}</span><span style="color:red;">"</span>"<span style="color:blue;"> </span><span style="color:red;">asis</span><span style="color:blue;">=</span>"<span style="color:blue;">true</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   92</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">attributes</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   93</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">references</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   94</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">log4net.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   95</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">references</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   96</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">asminfo</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   97</span> <span style="color:blue;">  &lt;/</span><span style="color:#a31515;">target</span><span style="color:blue;">&gt;</span></pre>
</div>
<h2>Using the build scripts</h2>
<p>You can invoke the website compiler like so:</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   13</span> <span style="color:blue;">&lt;!--</span><span style="color:green;"> build the frontendwebsite website </span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   14</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">property</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">website.name</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">FrontEndWebsite</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   15</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   16</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">assemblyfileset</span><span style="color:blue;"> </span><span style="color:red;">id</span><span style="color:blue;">=</span>"<span style="color:blue;">website.resources</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   17</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${resources.dir}/DynamicPDF.Generator.Server.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   18</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${resources.dir}/DynamicPDF.Merger.Server.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   19</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${resources.dir}/NetSpell.SpellChecker.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   20</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${resources.dir}/FreeTextBox.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   21</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">include</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">${resources.dir}/log4net.dll</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   22</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">assemblyfileset</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   23</span> <span style="color:blue;">    &lt;!--</span><span style="color:green;"> compile the site </span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   24</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">call</span><span style="color:blue;"> </span><span style="color:red;">target</span><span style="color:blue;">=</span>"<span style="color:blue;">general.compile.website</span>"<span style="color:blue;"> /&gt;</span></pre>
</div>
<p>And to copy config settings:</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   26</span> <span style="color:blue;">    &lt;!--</span><span style="color:green;"> copy the frontendwebsite web.config with replacing tokens </span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   27</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">filterchain</span><span style="color:blue;"> </span><span style="color:red;">id</span><span style="color:blue;">=</span>"<span style="color:blue;">config.settings</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   28</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">replacetokens</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   29</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">token</span><span style="color:blue;"> </span><span style="color:red;">key</span><span style="color:blue;">=</span>"<span style="color:blue;">token.defaultConnectionString</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">server=engelbart;database=CANON_CREATE_V6;uid=sa;pwd=</span>"<span style="color:blue;">/&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   30</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">token</span><span style="color:blue;"> </span><span style="color:red;">key</span><span style="color:blue;">=</span>"<span style="color:blue;">token.smtpserver</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">10.111.1.55</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   31</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">token</span><span style="color:blue;"> </span><span style="color:red;">key</span><span style="color:blue;">=</span>"<span style="color:blue;">token.baseSiteUrl</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">http://localhost:4870</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   32</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">token</span><span style="color:blue;"> </span><span style="color:red;">key</span><span style="color:blue;">=</span>"<span style="color:blue;">token.XHTMLTemplateUploadPath</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">C:Inetpubvirtual2005ProjectsCanonCanonCreate2005FrontEndWebsitexhtmltemplateuploads</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   33</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">token</span><span style="color:blue;"> </span><span style="color:red;">key</span><span style="color:blue;">=</span>"<span style="color:blue;">token.ConfigurationFilesDirectory</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">C:Inetpubvirtual2005ProjectsCanonCanonCreate2005ConfigurationFiles</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   34</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">replacetokens</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   35</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">filterchain</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   36</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   37</span> <span style="color:blue;">    &lt;!--</span><span style="color:green;"> copy the frontendwebsite.config.template.xml file to /frontendwebsite/web.config with tokens replaced </span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   38</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">property</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">template.sourcefilename</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">template.config.FrontEndWebsite.xml</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   39</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">call</span><span style="color:blue;"> </span><span style="color:red;">target</span><span style="color:blue;">=</span>"<span style="color:blue;">general.compile.website.copyconfig</span>"<span style="color:blue;"> /&gt;</span></pre>
</div>
<p>Here&#8217;s how I&#8217;m labelling my build. Generally I just want to use the CCNetLabel variable passed through from CCNet, but for added flexibility The target expects the ${assembly.label} variable. I simply check for CCNetLabel and copy it to the new variable.</p>
<div style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:8pt;color:black;">
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   68</span> <span style="color:blue;">&lt;!--</span><span style="color:green;"> label the assembly </span><span style="color:blue;">--&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   69</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">ifnot</span><span style="color:blue;"> </span><span style="color:red;">propertyexists</span><span style="color:blue;">=</span>"<span style="color:blue;">CCNetLabel</span>"<span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   70</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">fail</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">CCNetLabel property not set, so can't create labelled distribution files</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   71</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">ifnot</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   72</span> <span style="color:blue;">    &lt;</span><span style="color:#a31515;">trycatch</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   73</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">try</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   74</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">echo</span><span style="color:blue;"> </span><span style="color:red;">message</span><span style="color:blue;">=</span>"<span style="color:blue;">build number ${CCNetLabel}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   75</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">property</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">assembly.label</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">${CCNetLabel}</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   76</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">try</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   77</span> <span style="color:blue;">      &lt;</span><span style="color:#a31515;">catch</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   78</span> <span style="color:blue;">        &lt;</span><span style="color:#a31515;">property</span><span style="color:blue;"> </span><span style="color:red;">name</span><span style="color:blue;">=</span>"<span style="color:blue;">assembly.label</span>"<span style="color:blue;"> </span><span style="color:red;">value</span><span style="color:blue;">=</span>"<span style="color:blue;">1.0.0.1</span>"<span style="color:blue;"> /&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   79</span> <span style="color:blue;">      &lt;/</span><span style="color:#a31515;">catch</span><span style="color:blue;">&gt;</span></pre>
<pre style="line-height:1em;margin:0;"><span style="color:#2b91af;">   80</span> <span style="color:blue;">    &lt;/</span><span style="color:#a31515;">trycatch</span><span style="color:blue;">&gt;</span></pre>
</div>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/andrewmyhre.wordpress.com/21/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/andrewmyhre.wordpress.com/21/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/andrewmyhre.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/andrewmyhre.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/andrewmyhre.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/andrewmyhre.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/andrewmyhre.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/andrewmyhre.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/andrewmyhre.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/andrewmyhre.wordpress.com/21/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/andrewmyhre.wordpress.com/21/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/andrewmyhre.wordpress.com/21/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrewmyhre.wordpress.com&blog=2776051&post=21&subd=andrewmyhre&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://andrewmyhre.wordpress.com/2008/02/26/build-helpers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88fb9df2ebabdb5026a0544004b41738?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andrew Myhre</media:title>
		</media:content>
	</item>
		<item>
		<title>Small NAnt Gotcha</title>
		<link>http://andrewmyhre.wordpress.com/2008/02/07/small-nant-gotcha/</link>
		<comments>http://andrewmyhre.wordpress.com/2008/02/07/small-nant-gotcha/#comments</comments>
		<pubDate>Thu, 07 Feb 2008 12:34:35 +0000</pubDate>
		<dc:creator>Andrew Myhre</dc:creator>
				<category><![CDATA[CI]]></category>
		<category><![CDATA[nant]]></category>
		<category><![CDATA[Continuous Integration]]></category>

		<guid isPermaLink="false">http://andrewmyhre.wordpress.com/?p=16</guid>
		<description><![CDATA[Say I have two XML build files. The first is intended to call a target in the second.
Example1.xml:
  .cf { font-family: Courier New; font-size: 8pt; color: black; background: white; } .cl { margin: 0px; } .cln { color: #2b91af; } .cb1 { color: blue; } .cb2 { color: #a31515; } .cb3 { color: red; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrewmyhre.wordpress.com&blog=2776051&post=16&subd=andrewmyhre&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Say I have two XML build files. The first is intended to call a target in the second.</p>
<p>Example1.xml:</p>
<p><!-- {\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue255;\red255\green255\blue255;\red163\green21\blue21;\red255\green0\blue0;\red0\green0\blue0;}??\fs20 \cf1 &lt;?\cf3 xml\cf1  \cf4 version\cf1 =\cf0 "\cf1 1.0\cf0 "\cf1 ?&gt;\par ??&lt;\cf3 project\cf1  \cf4 name\cf1 =\cf0 "\cf1 Master build file\cf0 "\cf1  \cf4 default\cf1 =\cf0 "\cf1 build\cf0 "\cf1  \cf4 basedir\cf1 =\cf0 "\cf1 .\cf0 "\cf1 &gt;\par ??\par ??  &lt;\cf3 echo\cf1  \cf4 message\cf1 =\cf0 "\cf1 first\cf0 "\cf1  /&gt;\par ??\par ??  &lt;\cf3 include\cf1  \cf4 buildfile\cf1 =\cf0 "\cf1 example2.xml\cf0 "\cf1  /&gt;\par ??\par ??  &lt;\cf3 target\cf1  \cf4 name\cf1 =\cf0 "\cf1 build\cf0 "\cf1  \cf4 description\cf1 =\cf0 "\cf1 Main target\cf0 "\cf1 &gt;\par ??    &lt;\cf3 echo\cf1  \cf4 message\cf1 =\cf0 "\cf1 second\cf0 "\cf1  /&gt;\par ??    &lt;\cf3 call\cf1  \cf4 target\cf1 =\cf0 "\cf1 secondary.target\cf0 "\cf1  /&gt;\par ??  &lt;/\cf3 target\cf1 &gt;\par ??&lt;/\cf3 project\cf1 &gt;} -->  .cf { font-family: Courier New; font-size: 8pt; color: black; background: white; } .cl { margin: 0px; } .cln { color: #2b91af; } .cb1 { color: blue; } .cb2 { color: #a31515; } .cb3 { color: red; } </p>
<div class="cf">
<pre><span class="cln">    1</span> <span class="cb1">&lt;?</span><span class="cb2">xml</span><span class="cb1"> </span><span class="cb3">version</span><span class="cb1">=</span>"<span class="cb1">1.0</span>"<span class="cb1">?&gt;</span></pre>
<pre><span class="cln">    2</span> <span class="cb1">&lt;</span><span class="cb2">project</span><span class="cb1"> </span><span class="cb3">name</span><span class="cb1">=</span>"<span class="cb1">Master build file</span>"<span class="cb1"> </span><span class="cb3">default</span><span class="cb1">=</span>"<span class="cb1">build</span>"<span class="cb1"> </span><span class="cb3">basedir</span><span class="cb1">=</span>"<span class="cb1">.</span>"<span class="cb1">&gt;</span></pre>
<pre><span class="cln">    3</span></pre>
<pre><span class="cln">    4</span> <span class="cb1">  &lt;</span><span class="cb2">echo</span><span class="cb1"> </span><span class="cb3">message</span><span class="cb1">=</span>"<span class="cb1">first</span>"<span class="cb1"> /&gt;</span></pre>
<pre><span class="cln">    5</span></pre>
<pre><span class="cln">    6</span> <span class="cb1">  &lt;</span><span class="cb2">include</span><span class="cb1"> </span><span class="cb3">buildfile</span><span class="cb1">=</span>"<span class="cb1">example2.xml</span>"<span class="cb1"> /&gt;</span></pre>
<pre><span class="cln">    7</span></pre>
<pre><span class="cln">    8</span> <span class="cb1">  &lt;</span><span class="cb2">target</span><span class="cb1"> </span><span class="cb3">name</span><span class="cb1">=</span>"<span class="cb1">build</span>"<span class="cb1"> </span><span class="cb3">description</span><span class="cb1">=</span>"<span class="cb1">Main target</span>"<span class="cb1">&gt;</span></pre>
<pre><span class="cln">    9</span> <span class="cb1">    &lt;</span><span class="cb2">echo</span><span class="cb1"> </span><span class="cb3">message</span><span class="cb1">=</span>"<span class="cb1">second</span>"<span class="cb1"> /&gt;</span></pre>
<pre><span class="cln">   10</span> <span class="cb1">    &lt;</span><span class="cb2">call</span><span class="cb1"> </span><span class="cb3">target</span><span class="cb1">=</span>"<span class="cb1">secondary.target</span>"<span class="cb1"> /&gt;</span></pre>
<pre><span class="cln">   11</span> <span class="cb1">  &lt;/</span><span class="cb2">target</span><span class="cb1">&gt;</span></pre>
<pre><span class="cln">   12</span> <span class="cb1">&lt;/</span><span class="cb2">project</span><span class="cb1">&gt;</span></pre>
</div>
<p>Example2.xml:</p>
<p>.cf { font-family: Courier New; font-size: 8pt; color: black; background: white; } .cl { margin: 0px; } .cln { color: #2b91af; } .cb1 { color: blue; } .cb2 { color: #a31515; } .cb3 { color: red; } </p>
<div class="cf">
<pre><span class="cln">    1</span> <span class="cb1">&lt;?</span><span class="cb2">xml</span><span class="cb1"> </span><span class="cb3">version</span><span class="cb1">=</span>"<span class="cb1">1.0</span>"<span class="cb1">?&gt;</span></pre>
<pre><span class="cln">    2</span></pre>
<pre><span class="cln">    3</span> <span class="cb1">&lt;</span><span class="cb2">target</span><span class="cb1"> </span><span class="cb3">name</span><span class="cb1">=</span>"<span class="cb1">secondary.target</span>"<span class="cb1">&gt;</span></pre>
<pre><span class="cln">    4</span> <span class="cb1">  &lt;</span><span class="cb2">echo</span><span class="cb1"> </span><span class="cb3">message</span><span class="cb1">=</span>"<span class="cb1">third</span>"<span class="cb1"> /&gt;</span></pre>
<pre><span class="cln">    5</span> <span class="cb1">&lt;/</span><span class="cb2">target</span><span class="cb1">&gt;</span></pre>
</div>
<p>I had expect that the secondary.target target would not be called until after the build target was called. Instead:</p>
<p><!-- {\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;}??\fs20 NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006)\par ??Copyright (C) 2001-2006 Gerry Shaw\par ??http://nant.sourceforge.net\par ??\par ??Buildfile: file:///C:/Inetpub/virtual2005/Projects/Canon/CanonCreate2005/example1.xml\par ??Target framework: Microsoft .NET Framework 2.0\par ??Target(s) specified: build\par ??\par ??[echo] first\par ??[echo] third\par ??\par ??build:\par ??\par ??[echo] second\par ??\par ??BUILD FAILED\par ??\par ??Target 'secondary.target' does not exist in this project.\par ??\par ??Total time: 0 seconds.} -->  .cf { font-family: Courier New; font-size: 8pt; color: black; background: white; } .cl { margin: 0px; } </p>
<div class="cf">
<pre>NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006)</pre>
<pre>Copyright (C) 2001-2006 Gerry Shaw</pre>
<pre>http://nant.sourceforge.net</pre>
<pre></pre>
<pre>Buildfile: file:///C:/Inetpub/virtual2005/Projects/Canon/CanonCreate2005/example1.xml</pre>
<pre>Target framework: Microsoft .NET Framework 2.0</pre>
<pre>Target(s) specified: build</pre>
<pre></pre>
<pre>[echo] first</pre>
<pre>[echo] third</pre>
<pre></pre>
<pre>build:</pre>
<pre></pre>
<pre>[echo] second</pre>
<pre></pre>
<pre>BUILD FAILED</pre>
<pre></pre>
<pre>Target 'secondary.target' does not exist in this project.</pre>
<pre></pre>
<pre>Total time: 0 seconds.</pre>
</div>
<p>Huh? Why did the output go &#8220;first&#8221;, &#8220;third&#8221;, then &#8220;second&#8221;? And why does it say secondary.target doesn&#8217;t exist?</p>
<p>The documentation for the &lt;include&gt; task states:</p>
<p><i>Any global (project level) tasks in the included build file are executed when this task is executed. Tasks in target elements are only executed if that target is executed. </i></p>
<p>Which means my build file should be executing correctly. It&#8217;s in a target, isn&#8217;t it?</p>
<p>So I tried wrapping the secondary target in a project tag, and lo and behold:</p>
<p><!-- {\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;??\red0\green0\blue0;\red255\green255\blue255;}??\fs20 NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006)\par ??Copyright (C) 2001-2006 Gerry Shaw\par ??http://nant.sourceforge.net\par ??\par ??Buildfile: file:///C:/Inetpub/virtual2005/Projects/Canon/CanonCreate2005/example1.xml\par ??Target framework: Microsoft .NET Framework 2.0\par ??Target(s) specified: build\par ??\par ??[echo] first\par ??\par ??build:\par ??\par ??[echo] second\par ??\par ??secondary.target:\par ??\par ??[echo] third\par ??\par ??BUILD SUCCEEDED\par ??\par ??Total time: 0 seconds.} -->  .cf { font-family: Courier New; font-size: 8pt; color: black; background: white; } .cl { margin: 0px; } </p>
<div class="cf">
<pre>NAnt 0.85 (Build 0.85.2478.0; release; 14/10/2006)</pre>
<pre>Copyright (C) 2001-2006 Gerry Shaw</pre>
<pre>http://nant.sourceforge.net</pre>
<pre></pre>
<pre>Buildfile: file:///C:/Inetpub/virtual2005/Projects/Canon/CanonCreate2005/example1.xml</pre>
<pre>Target framework: Microsoft .NET Framework 2.0</pre>
<pre>Target(s) specified: build</pre>
<pre></pre>
<pre>[echo] first</pre>
<pre></pre>
<pre>build:</pre>
<pre></pre>
<pre>[echo] second</pre>
<pre></pre>
<pre>secondary.target:</pre>
<pre></pre>
<pre>[echo] third</pre>
<pre></pre>
<pre>BUILD SUCCEEDED</pre>
<pre></pre>
<pre>Total time: 0 seconds.</pre>
</div>
<p>So the NAnt docs aren&#8217;t entirely complete, are they. So I suppose the tag &lt;project&gt; is really a way of saying &#8220;this is build script which I want to control the execution for, instead of just processing the whole file as NAnt reads it&#8221;.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/andrewmyhre.wordpress.com/16/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/andrewmyhre.wordpress.com/16/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/andrewmyhre.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/andrewmyhre.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/andrewmyhre.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/andrewmyhre.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/andrewmyhre.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/andrewmyhre.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/andrewmyhre.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/andrewmyhre.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/andrewmyhre.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/andrewmyhre.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=andrewmyhre.wordpress.com&blog=2776051&post=16&subd=andrewmyhre&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://andrewmyhre.wordpress.com/2008/02/07/small-nant-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88fb9df2ebabdb5026a0544004b41738?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Andrew Myhre</media:title>
		</media:content>
	</item>
	</channel>
</rss>