<?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/"
	>

<channel>
	<title>The Inquisitive Coder - Davy Brion&#039;s Blog &#187; MSBuild</title>
	<atom:link href="http://davybrion.com/blog/category/msbuild/feed/" rel="self" type="application/rss+xml" />
	<link>http://davybrion.com/blog</link>
	<description>Trying to walk that thin line between intelligence and ignorance</description>
	<lastBuildDate>Thu, 29 Jul 2010 20:51:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Refactor Your Build Scripts</title>
		<link>http://davybrion.com/blog/2009/12/refactor-your-build-scripts/</link>
		<comments>http://davybrion.com/blog/2009/12/refactor-your-build-scripts/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 14:01:04 +0000</pubDate>
		<dc:creator>Davy Brion</dc:creator>
				<category><![CDATA[MSBuild]]></category>

		<guid isPermaLink="false">http://davybrion.com/blog/?p=2017</guid>
		<description><![CDATA[Just refactored our build scripts because i was getting annoyed at the amount of duplicate XML in each project’s build file.&#160; It now looks like this: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34; ?&#62; &#60;Project DefaultTargets=&#34;Build&#34; xmlns=&#34;http://schemas.microsoft.com/developer/msbuild/2003&#34;&#62; &#160; &#160; &#60;Import Project=&#34;$(MSBuildExtensionsPath)\ItemSolutions\build_g3_db_creation_sl_tests.proj&#34; /&#62; &#160; &#160; &#60;PropertyGroup&#62; &#160;&#160;&#160; &#60;ProjectName&#62;MY_PROJECT_NAME&#60;/ProjectName&#62; &#160;&#160;&#160; &#60;GenesisProjectCode&#62;MY_PROJECT_NAME&#60;/GenesisProjectCode&#62;&#160;&#160;&#160; &#160;&#160;&#160; &#60;GenesisAnalysisId&#62;1337&#60;/GenesisAnalysisId&#62; &#160;&#160;&#160; &#60;GenesisDocumentDescription&#62;MY_GENESIS_DOCUMENT_DESCRIPTION&#60;/GenesisDocumentDescription&#62; &#160;&#160;&#160; &#60;LavalampDirectory&#62;\\LAVALAMP\MY_PROJECT_FOLDER&#60;/LavalampDirectory&#62; &#160;&#160;&#160; &#60;DatabaseSchema&#62;MY_DATABASE_SCHEMA&#60;/DatabaseSchema&#62; &#160;&#160;&#160; &#60;DatabaseServer&#62;MY_DATABASE_SERVER&#60;/DatabaseServer&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Just refactored our build scripts because i was getting annoyed at the amount of duplicate XML in each project’s build file.&#160; It now looks like this:</p>
<div style="font-family: consolas; background: white; color: black; font-size: 10pt">
<p style="margin: 0px"><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>&quot;<span style="color: blue">1.0</span>&quot;<span style="color: blue"> </span><span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot;<span style="color: blue"> ?&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&lt;</span><span style="color: #a31515">Project</span><span style="color: blue"> </span><span style="color: red">DefaultTargets</span><span style="color: blue">=</span>&quot;<span style="color: blue">Build</span>&quot;<span style="color: blue"> </span><span style="color: red">xmlns</span><span style="color: blue">=</span>&quot;<span style="color: blue">http://schemas.microsoft.com/developer/msbuild/2003</span>&quot;<span style="color: blue">&gt;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">Import</span><span style="color: blue"> </span><span style="color: red">Project</span><span style="color: blue">=</span>&quot;<span style="color: blue">$(MSBuildExtensionsPath)\ItemSolutions\build_g3_db_creation_sl_tests.proj</span>&quot;<span style="color: blue"> /&gt;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;</span><span style="color: #a31515">PropertyGroup</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">ProjectName</span><span style="color: blue">&gt;</span>MY_PROJECT_NAME<span style="color: blue">&lt;/</span><span style="color: #a31515">ProjectName</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">GenesisProjectCode</span><span style="color: blue">&gt;</span>MY_PROJECT_NAME<span style="color: blue">&lt;/</span><span style="color: #a31515">GenesisProjectCode</span><span style="color: blue">&gt;&#160;&#160;&#160; </span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">GenesisAnalysisId</span><span style="color: blue">&gt;</span>1337<span style="color: blue">&lt;/</span><span style="color: #a31515">GenesisAnalysisId</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">GenesisDocumentDescription</span><span style="color: blue">&gt;</span>MY_GENESIS_DOCUMENT_DESCRIPTION<span style="color: blue">&lt;/</span><span style="color: #a31515">GenesisDocumentDescription</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">LavalampDirectory</span><span style="color: blue">&gt;</span>\\LAVALAMP\MY_PROJECT_FOLDER<span style="color: blue">&lt;/</span><span style="color: #a31515">LavalampDirectory</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">DatabaseSchema</span><span style="color: blue">&gt;</span>MY_DATABASE_SCHEMA<span style="color: blue">&lt;/</span><span style="color: #a31515">DatabaseSchema</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">DatabaseServer</span><span style="color: blue">&gt;</span>MY_DATABASE_SERVER<span style="color: blue">&lt;/</span><span style="color: #a31515">DatabaseServer</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">DatabaseUser</span><span style="color: blue">&gt;</span>MY_DATABASE_USER<span style="color: blue">&lt;/</span><span style="color: #a31515">DatabaseUser</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">DatabasePassword</span><span style="color: blue">&gt;</span>MY_DATABASE_PASSWORD<span style="color: blue">&lt;/</span><span style="color: #a31515">DatabasePassword</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">DatabaseScriptsSubversionLocation</span><span style="color: blue">&gt;</span>MY_DATABASESCRIPT_SUBVERSION_LOCATION<span style="color: blue">&lt;/</span><span style="color: #a31515">DatabaseScriptsSubversionLocation</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">NormalTestConfigPath</span><span style="color: blue">&gt;</span>MY_PROJECT\bin\$(Configuration)\hibernate.cfg.xml<span style="color: blue">&lt;/</span><span style="color: #a31515">NormalTestConfigPath</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">TestConfigPathForBuildServer</span><span style="color: blue">&gt;</span>MY_PROJECT\hibernate.cfg.xml.onbuildserver<span style="color: blue">&lt;/</span><span style="color: #a31515">TestConfigPathForBuildServer</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">SilverlightTestAssemblyName</span><span style="color: blue">&gt;</span>MY_PROJECT.Silverlight.Tests.dll<span style="color: blue">&lt;/</span><span style="color: #a31515">SilverlightTestAssemblyName</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">SilverlightTestsXapLocation</span><span style="color: blue">&gt;</span>MY_PROJECT.Silverlight.Tests\Bin\$(Configuration)\MY_PROJECT.Silverlight.Tests.xap<span style="color: blue">&lt;/</span><span style="color: #a31515">SilverlightTestsXapLocation</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160;&#160;&#160; &lt;</span><span style="color: #a31515">SilverlightTestsDllLocation</span><span style="color: blue">&gt;</span>MY_PROJECT.Silverlight.Tests\Bin\$(Configuration)\MY_PROJECT.Silverlight.Tests.dll<span style="color: blue">&lt;/</span><span style="color: #a31515">SilverlightTestsDllLocation</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px"><span style="color: blue">&#160; &lt;/</span><span style="color: #a31515">PropertyGroup</span><span style="color: blue">&gt;</span></p>
<p style="margin: 0px">&#160;</p>
<p style="margin: 0px"><span style="color: blue">&lt;/</span><span style="color: #a31515">Project</span><span style="color: blue">&gt;</span></p>
</p></div>
<p>&#160;</p>
<p>This build script compiles all of the code, creates a new database from scratch, runs the unit tests (including the silverlight tests), publishes the testresults into <a href="http://davybrion.com/blog/2008/11/genesis-bridging-the-gap-between-requirement-and-code/" target="_blank">Genesis</a>, and updates our lavalamp.&#160; In case a particular build needs to divert from the standard operation procedure, you can override whatever target you want in the build process to customize it (or disable it).</p>
<p>Now ask yourself: is there any reason why you should tolerate duplication in your build scripts?</p>
]]></content:encoded>
			<wfw:commentRss>http://davybrion.com/blog/2009/12/refactor-your-build-scripts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using TeamCity&#8217;s NUnit support, while keeping the output around</title>
		<link>http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/</link>
		<comments>http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/#comments</comments>
		<pubDate>Sat, 19 Jul 2008 14:56:15 +0000</pubDate>
		<dc:creator>Davy Brion</dc:creator>
				<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://davybrion.com/blog/?p=178</guid>
		<description><![CDATA[I&#8217;ve been playing around with TeamCity a lot lately. It&#8217;s really amazing how easy to use and powerful it is. Definitely my favorite CI server for the time being&#8230; i&#8217;m even running it at home now for my personal projects. There was one issue at work that was somewhat hard to fix though. TeamCity has [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with <a href="http://www.jetbrains.com/teamcity/">TeamCity</a> a lot lately. It&#8217;s really amazing how easy to use and powerful it is. Definitely my favorite CI server for the time being&#8230; i&#8217;m even running it at home now for my personal projects.</p>
<p>There was one issue at work that was somewhat hard to fix though. TeamCity has fantastic integrated support for NUnit, but unfortunately it doesn&#8217;t write NUnit&#8217;s output to XML files like nunit-console.exe does.  After a bit of browsing, i found a <a href="http://intellij.net/forums/message.jspa?messageID=5218450#5218450">post</a> on the TeamCity forums that discussed a workaround on how to get the output. Unfortunately the workaround is a bit cumbersome as it requires you to you create an XML file which contains the arguments that TeamCity would pass to its NUnitLauncher task. </p>
<p>I believe in &#8216;script reuse&#8217; as much as i believe in &#8216;code reuse&#8217;, so every project&#8217;s build script merely imports a generic build script and then it just overwrites some variables that the generic script uses and then it kicks off the usual build process.  Since all of our projects will now be built by TeamCity Build Agents, and we definitely need to have NUnit&#8217;s results xml file i wanted to automate this whole thing as much as possible.</p>
<p>So instead of having to create (and thus, maintain) a cumbersome xml file for each project, i wrote an MSBuild task that would generate the xml file containing the arguments on the fly during the build, and would then pass those xml arguments to TeamCity&#8217;s NUnitLauncher.  This way we get to keep all of TeamCity&#8217;s NUnit integration goodness, while still keeping the NUnit result files around as well.</p>
<p>So now in my MSBuild file, i can just do this:</p>
<p><code></p>
<div style="font-family: Consolas; font-size: 10pt; color: black; background: white;">
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">CreateItem</span><span style="color: blue;"> </span><span style="color: red;">Include</span><span style="color: blue;">=</span>"<span style="color: blue;">**\Bin\Debug\*Tests*.dll</span>"<span style="color: blue;"> &gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &lt;</span><span style="color: #a31515;">Output</span><span style="color: blue;"> </span><span style="color: red;">TaskParameter</span><span style="color: blue;">=</span>"<span style="color: blue;">Include</span>"<span style="color: blue;"> </span><span style="color: red;">ItemName</span><span style="color: blue;">=</span>"<span style="color: blue;">TestAssemblies</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;/</span><span style="color: #a31515;">CreateItem</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">BuildTeamCityNUnitArguments</span><span style="color: blue;"> </span><span style="color: red;">HaltOnError</span><span style="color: blue;">=</span>"<span style="color: blue;">true</span>"<span style="color: blue;"> </span><span style="color: red;">HaltOnFirstTestFailure</span><span style="color: blue;">=</span>"<span style="color: blue;">true</span>"</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  </span><span style="color: red;">HaltOnFailureAtEnd</span><span style="color: blue;">=</span>"<span style="color: blue;">true</span>"<span style="color: blue;"> </span><span style="color: red;">TestAssemblies</span><span style="color: blue;">=</span>"<span style="color: blue;">@(TestAssemblies)</span>"</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  </span><span style="color: red;">NUnitResultsOutputFolder</span><span style="color: blue;">=</span>"<span style="color: blue;">TestResults</span>"<span style="color: blue;"> </span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  </span><span style="color: red;">PathOfNUnitArgumentsXmlFile</span><span style="color: blue;">=</span>"<span style="color: blue;">nunitarguments.xml</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">Exec</span><span style="color: blue;"> </span><span style="color: red;">Command</span><span style="color: blue;">=</span>"<span style="color: blue;">$(teamcity_dotnet_nunitlauncher) @@ nunitarguments.xml</span>"<span style="color: blue;"> /&gt;</span></p>
</div>
<p></code></p>
<p>As you can see, there is nothing project-specific in there so this just integrates nicely into each build that we need.  The only limitation to this approach is that TeamCity&#8217;s NUnitLauncher will write one NUnit result file for each assembly containing tests. Apparently there is no way in the current version of TeamCity to get it to combine those results.  We use an extra tool to analyze the NUnit output after the tests have run, and unfortunately it requires all of the results to be in one file.  I looked around for a way to merge the output of several NUnit result files, but i didn&#8217;t find something that was already available.  So i wrote another MSBuild task that would merge the output into one xml file:</p>
<p><code></p>
<div style="font-family: Consolas; font-size: 10pt; color: black; background: white;">
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">CreateItem</span><span style="color: blue;"> </span><span style="color: red;">Include</span><span style="color: blue;">=</span>"<span style="color: blue;">TestResults\*.xml</span>"<span style="color: blue;"> &gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &lt;</span><span style="color: #a31515;">Output</span><span style="color: blue;"> </span><span style="color: red;">TaskParameter</span><span style="color: blue;">=</span>"<span style="color: blue;">Include</span>"<span style="color: blue;"> </span><span style="color: red;">ItemName</span><span style="color: blue;">=</span>"<span style="color: blue;">NUnitOutputXmlFiles</span>"<span style="color: blue;">/&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;/</span><span style="color: #a31515;">CreateItem</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">NUnitMergeOutput</span><span style="color: blue;"> </span><span style="color: red;">NUnitOutputXmlFiles</span><span style="color: blue;">=</span>"<span style="color: blue;">@(NUnitOutputXmlFiles)</span>"<span style="color: blue;"> </span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: red;">PathOfMergedXmlFile</span><span style="color: blue;">=</span>"<span style="color: blue;">TestResults.xml</span>"<span style="color: blue;"> /&gt;</span></p>
</div>
<p></code></p>
<p>Now we finally have all of TeamCity&#8217;s goodness while we still get to run our post-test analysis on the NUnit result file that contains the testresults of all the test assemblies <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You can find the code of the MSBuild tasks <a href="http://davybrion.com/blog/stuff/">here</a>.  They are BSD-licensed so feel free to use them if you need them.</p>
]]></content:encoded>
			<wfw:commentRss>http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Basic MSBuild script</title>
		<link>http://davybrion.com/blog/2008/07/basic-msbuild-script/</link>
		<comments>http://davybrion.com/blog/2008/07/basic-msbuild-script/#comments</comments>
		<pubDate>Fri, 04 Jul 2008 17:40:58 +0000</pubDate>
		<dc:creator>Davy Brion</dc:creator>
				<category><![CDATA[MSBuild]]></category>

		<guid isPermaLink="false">http://davybrion.com/blog/?p=159</guid>
		<description><![CDATA[I spent some time with MSBuild this week&#8230; I actually like it (yea that&#8217;s right, i said it!), but it did take me some time to figure out how to write a basic build script from scratch that can be used to build a solution and run the tests. Obviously, i wanted the script to [...]]]></description>
			<content:encoded><![CDATA[<p>I spent some time with MSBuild this week&#8230; I actually like it (yea that&#8217;s right, i said it!), but it did take me some time to figure out how to write a basic build script from scratch that can be used to build a solution and run the tests. Obviously, i wanted the script to assume as little as possible, so i could pretty much drop it any solution folder and use it as is. The only thing that is hardcoded is the path the nunit console runner but other than that, this should provide a good start for pretty much any project.</p>
<p><code></p>
<div style="font-family: Consolas; font-size: 10pt; color: black; background: white;">
<p style="margin: 0px;"><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;"> </span><span style="color: red;">encoding</span><span style="color: blue;">=</span>"<span style="color: blue;">utf-8</span>"<span style="color: blue;"> ?&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&lt;</span><span style="color: #a31515;">Project</span><span style="color: blue;"> </span><span style="color: red;">DefaultTargets</span><span style="color: blue;">=</span>"<span style="color: blue;">Build</span>"<span style="color: blue;"> </span><span style="color: red;">xmlns</span><span style="color: blue;">=</span>"<span style="color: blue;">http://schemas.microsoft.com/developer/msbuild/2003</span>"<span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;</span><span style="color: #a31515;">Import</span><span style="color: blue;"> </span><span style="color: red;">Project</span><span style="color: blue;">=</span>"<span style="color: blue;">$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;</span><span style="color: #a31515;">PropertyGroup</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">Configuration</span><span style="color: blue;">&gt;</span>Debug<span style="color: blue;">&lt;/</span><span style="color: #a31515;">Configuration</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">NUnitRunner</span><span style="color: blue;">&gt;</span>C:\Program Files\NUnit 2.4.7\bin\nunit-console.exe<span style="color: blue;">&lt;/</span><span style="color: #a31515;">NUnitRunner</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;/</span><span style="color: #a31515;">PropertyGroup</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;</span><span style="color: #a31515;">ItemGroup</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">ProjectsToBuild</span><span style="color: blue;"> </span><span style="color: red;">Include</span><span style="color: blue;">=</span>"<span style="color: blue;">**\*.csproj</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;/</span><span style="color: #a31515;">ItemGroup</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &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;">BuildAll</span>"<span style="color: blue;"> </span><span style="color: red;">DependsOnTargets</span><span style="color: blue;">=</span>"<span style="color: blue;">Clean;CoreBuild;RunTests</span>"<span style="color: blue;">/&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &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;">CoreBuild</span>"<span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">MSBuild</span><span style="color: blue;"> </span><span style="color: red;">Projects</span><span style="color: blue;">=</span>"<span style="color: blue;">@(ProjectsToBuild)</span>"<span style="color: blue;"> </span><span style="color: red;">ContinueOnError</span><span style="color: blue;">=</span>"<span style="color: blue;">false</span>"<span style="color: blue;"> </span><span style="color: red;">Properties</span><span style="color: blue;">=</span>"<span style="color: blue;">Configuration=$(Configuration)</span>"<span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &lt;</span><span style="color: #a31515;">Output</span><span style="color: blue;"> </span><span style="color: red;">ItemName</span><span style="color: blue;">=</span>"<span style="color: blue;">BuildOutput</span>"<span style="color: blue;"> </span><span style="color: red;">TaskParameter</span><span style="color: blue;">=</span>"<span style="color: blue;">TargetOutputs</span>"<span style="color: blue;">/&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;/</span><span style="color: #a31515;">MSBuild</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;/</span><span style="color: #a31515;">Target</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &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></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">MSBuild</span><span style="color: blue;"> </span><span style="color: red;">Projects</span><span style="color: blue;">=</span>"<span style="color: blue;">@(ProjectsToBuild)</span>"<span style="color: blue;"> </span><span style="color: red;">ContinueOnError</span><span style="color: blue;">=</span>"<span style="color: blue;">false</span>"<span style="color: blue;"> </span><span style="color: red;">Targets</span><span style="color: blue;">=</span>"<span style="color: blue;">Clean</span>"<span style="color: blue;"> </span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  </span><span style="color: red;">Properties</span><span style="color: blue;">=</span>"<span style="color: blue;">Configuration=$(Configuration)</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;/</span><span style="color: #a31515;">Target</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &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;">RunTests</span>"<span style="color: blue;"> </span><span style="color: red;">DependsOnTargets</span><span style="color: blue;">=</span>"<span style="color: blue;">CoreBuild</span>"<span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">CreateItem</span><span style="color: blue;"> </span><span style="color: red;">Include</span><span style="color: blue;">=</span>"<span style="color: blue;">**\Bin\Debug\*Tests*.dll</span>"<span style="color: blue;"> &gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &nbsp; &lt;</span><span style="color: #a31515;">Output</span><span style="color: blue;"> </span><span style="color: red;">TaskParameter</span><span style="color: blue;">=</span>"<span style="color: blue;">Include</span>"<span style="color: blue;"> </span><span style="color: red;">ItemName</span><span style="color: blue;">=</span>"<span style="color: blue;">TestAssemblies</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;/</span><span style="color: #a31515;">CreateItem</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &nbsp; &lt;</span><span style="color: #a31515;">NUnit</span><span style="color: blue;"> </span><span style="color: red;">ToolPath</span><span style="color: blue;">=</span>"<span style="color: blue;">$(NUnitPath)</span>"<span style="color: blue;"> </span><span style="color: red;">Assemblies</span><span style="color: blue;">=</span>"<span style="color: blue;">@(TestAssemblies)</span>"<span style="color: blue;"> </span><span style="color: red;">DisableShadowCopy</span><span style="color: blue;">=</span>"<span style="color: blue;">true</span>"<span style="color: blue;"> /&gt;</span></p>
<p style="margin: 0px;"><span style="color: blue;">&nbsp; &lt;/</span><span style="color: #a31515;">Target</span><span style="color: blue;">&gt;</span></p>
<p style="margin: 0px;">&nbsp;</p>
<p style="margin: 0px;"><span style="color: blue;">&lt;/</span><span style="color: #a31515;">Project</span><span style="color: blue;">&gt;</span></p>
</div>
<p></code></p>
<p>it uses the <a href="http://msbuildtasks.tigris.org/">MSBuild Community tasks</a> btw&#8230; Like i said, this is a very basic script. It only builds your solution and it runs all of your tests. That&#8217;s it. No packaging of the output, no code coverage (if you&#8217;re really doing TDD, code coverage is useless anyway), no whatever else you can think of.  But you can easily add all of that stuff of course <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now watch me get flamed for not using nant <img src='http://davybrion.com/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://davybrion.com/blog/2008/07/basic-msbuild-script/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>
