Category Archives: Information Technology

What i dislike about the Web.config Transformation in VS2010

There are a couple of things that i strongly dislike about the Web.config transformation in VS2010: Only works with XML files (eg: Can’t be used to generate a release notes.txt file) Does not seem to support externalized sections, eg: log4net.config … Continue reading

Posted in MSBuild, Visual Studio | Leave a comment

Making the TemplateFileTask easier to use…

One of the disadvantages of the TemplateFile task (msbuildtasks) is the fact that it requires a lot of typing to define template values: <ItemGroup Condition= " ‘$(ConfigurationEnvironment)’==’build’ "> <Tokens Include="a"> <ReplacementValue>localhost</ReplacementValue> </Tokens> <Tokens Include="b"> <ReplacementValue><mynode/></ReplacementValue> </Tokens> </ItemGroup> Here is a … Continue reading

Posted in MSBuild | Leave a comment

Clean TemplateFile hack

A while ago i wrote about a Clever TemplateFile hack to use some xml block as ReplacementValue. Today i realized there is a clean way to achieve this by defining the value as CDATA: <TemplateTokens Include="mex"> <ReplacementValue> <![CDATA[<endpoint address="mex" binding="mexHttpBinding" … Continue reading

Posted in MSBuild | Leave a comment

Quick reminder about the workings of Type.IsAssignableFrom

Here is a quick reminder about the workings of Type.IsAssignableFrom: class Fruit {} class Banana : Fruit {} [Test] public void CanAssignBananaToFruit() { var fruit = typeof (Fruit); var banana = typeof (Banana); Assert.IsTrue(fruit.IsAssignableFrom(banana)); } [Test] public void CanNotAssignFruitToBanana() { … Continue reading

Posted in C# | Leave a comment

Removing Dead Tracks (Duplicates that don’t exist) from iTunes using C#

Last week i noticed the following post from Scott Hanselman: Removing Dead Tracks (Duplicates that don’t exist) from iTunes using C#. As a good boy scout i noticed that these days iTunesLib.IITTrackCollection inherits from IEnumerable so i rewrote the code … Continue reading

Posted in C# | Leave a comment

Sometimes you can write it better than Resharper

Here is a real-life example of when people are much better expressing intent than a tool: Consider the following code from a typical Silverlight Navigation application: foreach (UIElement child in LinksStackPanel.Children) { var hb = child as HyperlinkButton; if (hb … Continue reading

Posted in C# | Leave a comment

Setting up a self-contained build

Here is something you may have experienced already: As a newcomer on an existing project, you check out the code from source-control and discover that the build is broken. When you ask around no-one else seems to have that problem … Continue reading

Posted in MSBuild | Leave a comment

Convention over configuration with MSBuild

A while ago i blogged that i was using the TemplateFile task from the

Posted in MSBuild | Leave a comment

WCF REST: generate correct Content-Length header for HEAD request

The point of a HEAD request is to return a Content-Length header, but with an empty body. The WCF transport stack has the annoying ‘feature’ that it ‘corrects’ the Content-Length header based on the stream that is returned. With the … Continue reading

Posted in C# | Leave a comment

Support both GET and HEAD requests on the same method with WCF REST

A while ago i had to modify an existing WCF REST service which was being consumed by BITS. Apparently the implementation has changed in Windows7 in such a way that the BITS client first makes a HEAD request to discover … Continue reading

Posted in C# | Leave a comment