<?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>inquisitive: adjective. given to inquiry, research, or asking questions; eager for knowledge; intellectually curious</description> <lastBuildDate>Sun, 29 Jan 2012 10:48:12 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</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></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><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2009%2F12%2Frefactor-your-build-scripts%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2009/12/refactor-your-build-scripts/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2009/12/refactor-your-build-scripts/"  data-text="Refactor Your Build Scripts" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2009/12/refactor-your-build-scripts/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2009/12/refactor-your-build-scripts/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></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've been playing around with TeamCity a lot lately. It's really amazing how easy to use and powerful it is. Definitely my favorite CI server for the time being... i'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've been playing around with <a
href="http://www.jetbrains.com/teamcity/">TeamCity</a> a lot lately. It's really amazing how easy to use and powerful it is. Definitely my favorite CI server for the time being... i'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't write NUnit'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 'script reuse' as much as i believe in 'code reuse', so every project'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'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's NUnitLauncher.  This way we get to keep all of TeamCity'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'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'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'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://d18sni7re4ly7f.cloudfront.net/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><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2008%2F07%2Fusing-teamcitys-nunit-support-while-keeping-the-output-around%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/"  data-text="Using TeamCity&#8217;s NUnit support, while keeping the output around" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2008/07/using-teamcitys-nunit-support-while-keeping-the-output-around/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></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... I actually like it (yea that'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... I actually like it (yea that'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... Like i said, this is a very basic script. It only builds your solution and it runs all of your tests. That's it. No packaging of the output, no code coverage (if you'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://d18sni7re4ly7f.cloudfront.net/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://d18sni7re4ly7f.cloudfront.net/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p><div
class="bottomcontainerBox" style=""><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <iframe
src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fdavybrion.com%2Fblog%2F2008%2F07%2Fbasic-msbuild-script%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width=85px; height:21px;" allowTransparency="true"></iframe></div><div
style="float:left; width:80px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <g:plusone size="medium" href="http://davybrion.com/blog/2008/07/basic-msbuild-script/"></g:plusone></div><div
style="float:left; width:95px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"> <a
href="http://twitter.com/share" class="twitter-share-button" data-url="http://davybrion.com/blog/2008/07/basic-msbuild-script/"  data-text="Basic MSBuild script" data-count="horizontal" data-via="davybrion">Tweet</a></div><div
style="float:left; width:105px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script type="in/share" data-url="http://davybrion.com/blog/2008/07/basic-msbuild-script/" data-counter="right"></script></div><div
style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://davybrion.com/blog/2008/07/basic-msbuild-script/"></script></div></div><div
style="clear:both"></div><div
style="padding-bottom:4px;"></div>]]></content:encoded> <wfw:commentRss>http://davybrion.com/blog/2008/07/basic-msbuild-script/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/23 queries in 0.009 seconds using disk: basic
Object Caching 495/533 objects using disk: basic
Content Delivery Network via Amazon Web Services: CloudFront: d18sni7re4ly7f.cloudfront.net

Served from: davybrion.com @ 2012-02-07 08:09:33 -->
