TFSBuild 2010 & NUnit Integration

Wednesday 04 January 2012 at 12:30 pm

Always keen that our adopted environment shouldn't dictate tooling it was important that we could achieve a good level integration between with testing tools and Team Foundation Server; however as TFS 2010 moved to using web services and XAML build workflow it can look rather challenging.

Interesting note

The snippets below are based around NUnit testing tool but it could be employed just as easily for others that are able to output their results XML in the same format, xUnit being a fine example.

Looking at integration we identified two essential requirements;

  • NUnit-Console test runner executes as part of the build workflow
  • Test results are published back into TFS 2010 and statistics
Read More

Bin deploying linked files

Friday 16 December 2011 at 09:18 am

If like me you don't want to have duplicate copies of your bin dependencies between your libraries/packages folder and "/_bin_deployableAssemblies" you'll want to link them; unfortunately the default Microsoft.WebApplication.targets won't publish them - absurd I know!

Through experimentation I've found the most elegant solution is to have have a custom targets files (checked into source control and branched from a common location) that I import into my web projects. It simply overrides one of the targets in Microsoft.WebApplication.targets and copies linked files to a bin sub-folder before adding them to the CreateItem collection that is later used when building/publishing.

CopyLinkedBinDeployableAssemblies.targets

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Target Name="_CopyBinDeployableAssemblies" Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
    <Copy Condition=" '%(Content.Link)' != '' " SourceFiles="%(Content.Identity)" DestinationFiles="$(MSBuildProjectDirectory)\bin\%(Content.Link)" />
    <CreateItem Include="$(MSBuildProjectDirectory)\bin\_bin_deployableAssemblies\**\*.*" Condition="Exists('$(MSBuildProjectDirectory)\bin\_bin_deployableAssemblies')">
      <Output ItemName="_binDeployableAssemblies" TaskParameter="Include" />
    </CreateItem>
    <CreateItem Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*" Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
      <Output ItemName="_binDeployableAssemblies" TaskParameter="Include" />
    </CreateItem>
    <Copy SourceFiles="@(_binDeployableAssemblies)" DestinationFolder="$(OutDir)\%(RecursiveDir)" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
  </Target>
</Project>;

Then in my web .csproj project file add an import link to the new targets file;

<Import Project="$(MSBuildProjectDirectory)\..\..\BuildSupport\Targets\CopyLinkedBinDeployableAssemblies.targets" />

Important! Make sure you put this after the Import to Microsoft.WebApplication.targets.

Finally...

There seems to be a myth that _bin_deployableAssemblies is MVC3 only which of course is utter tosh, this works for any project that uses Microsoft.WebApplication.targets; I know this as we use it in our FubuMVC projects to copy Simple.Data MEF dependencies :-)

Git mergetool with Araxis

Monday 05 December 2011 at 10:00 pm

Just thought I'd drop this quick note should you also find the settings on the Araxis website don't work with your .gitconfig, I went through many attempts but this simple version worked for me.

[merge]
	tool = araxis
[mergetool "araxis"]
	cmd = araxisgitmerge.exe \"$REMOTE\" \"$BASE\" \"$PWD/LOCAL\" \"$PWD/MERGED\"

…or alternatively…

git config --global merge.tool araxis
git config --global mergetool.araxis.cmd 'araxisgitmerge.exe \"$REMOTE\" \"$BASE\" \"$PWD/LOCAL\" \"$PWD/MERGED\"'

Note: I added the Araxis installation directory to my PATH environment variable so not necessary above.

Reading list

  • Josh Arnold - Web developer, author & contributor of FubuMVC
  • Jeremy D Miller - Web developer, author & contributor of StructureMap & FubuMVC
  • Roy Osherove - Unit Testing, Agile Development, Leadership & .NET
  • Rob Ashton - Technical Lead & author of MvcEx and AutoPoco
Randolph Burt:

Very interesting blog post – and one where I find myself saying “I agree” as I read each sentence. The other day I was thinking how one’s life journey takes different twists and turns as you interact …

Jon:

Wow! Can I work for you?! ** Breath of fresh air in management! **

Ian:

There will have to be very strict guidelines, the last thing you want is dispute over “.. but you gave him 5 credits and her only 3?!” which will undoubtedly lead to the scheme being rescinded. That re…

Gary Ewan Park:

This is a very interesting idea! It does leave some questions about how it is “policed”, and who decides whether a particular blog post, or SO answer warrants the credits, but I really do think that i…

Chris Marisic:

Being both a developer and a leader of developers, I have found little to be as integral to the speed and success of software development as intellisense. This is also why I leverage R# on top of Vis…

Franc:

I have to admit that Spark won me over very quickly, yes it is not perfect and yes I am not an expert in the subject but it has provided me with new skills. I have been a victim of its lack of intellis…