My first foray into Ink – the Dots-And-Boxes game.

As a kid I  used to spend a lot of time in the car traveling from Minneapolis to the lakes country of Minnesota (near Detroit Lakes, if anyone cares).  Two 4-hours trips a weekend was pretty normal.  So what do you do with 6 kids crammed into a Suburban for 250 miles?  Whatever it takes…

4

MSBuild Task Generator: Part 11. IntRange explained and the exciting conclusion …

Tomorrow … next week … read: the next time I post.   Specifying an integer range is one of the problems we need solve to have a reasonably robust task generator.  It’s one thing to say that a property is assignable from an int, but another to say that the value must be valid.  We…

4

MSBuild Task Generator: Part 10. Generating properties and the OneOf constraint explained

Yesterday we generated the fields and initializers, so today let’s move on to the properties.   Let’s quickly look at an example input:   <?xml version=“1.0“ encoding=“utf-8“ ?> <Tasks>       <Task Namespace=“ArrayTest“ Class=“Test1“>             <Property Name=“StringWithOneOf“ Type=“System.String“ OneOf=“Value1;Value2;Value3“/>       </Task> </Tasks>   This should render the following (class and namespace removed):   #region StringWithOneOf private…

0

MSBuild Task Generator: Part 9. GenerateField and generating array initializers in the CodeDOM.

GenerateField is pretty straight-forward .. here, just look:   CodeMemberField GenerateField(MBFTaskProperty tp) {       string privateName = string.Format(“m_{0}”, tp.Name);       CodeMemberField cmf = new CodeMemberField(tp.Type, privateName); cmf.Attributes = MemberAttributes.Private;         if (StringHasData(tp.Default))       {             if (tp.IsArray)             {                   cmf.InitExpression = new CodeArrayCreateExpression(tp.Type, tp.DefaultExpressionArray);             }             else             {                   cmf.InitExpression =…

1

MSBuild Task Generator: Part 8. Implementing ITaskGenerator (a series within a series)

Now that we’re all good friends with the CodeDOM it’s time to look at the far less interesting reason for this whole series … generating MSBuild tasks.   Since we’ve implemented ITask and ITaskProperty it’s time to implement ITaskGenerator.   We’ll be taking a top-down approach to this.  We’ll start by looking at the implementation…

2

MSBuild Task Generator: Part 7. Rendering a loop in the CodeDOM.

For those that asked – on a Friday “tomorrow” means Monday. J   And a few people have asked “what does this have to do with MSBuild” – yeah, I suppose I’m a bit off topic but I’m trying to lay a little foundation so that when I’m talking about the task generator I don’t…

0

MSBuild Task Generator: Part 6. Conditional statements in the CodeDOM.

Yesterday we introduced the CodeDOM and covered some fundamentals.  Creating a namespace, a class, a member method and a method body.  Today we’re going to cover conditionals.  I know I promised loops too but conditionals is taking enough space that if I tried to do loops too this would turn into a novel, not a…

1

MSBuild Task Generator: Part 5. Introducing the CodeDOM. Hello World was never so much fun.

Yesterday we looked at a basic implementation of ITaskProperty – and I promised we start looking at the code generation today.  We won’t be looking at the XML -> C# rendering but rather the CodeDOM and generating some basic expressions.   Before we go on I’m going to assume you are familiar with the CodeDOM…

2

MSBuild Task Generator: Part 3. Implementing ITask

Yesterday we introduced the ITask interface.  Today we’ll look at a simple implementation of the ITask interface.   I’m not a big fan of reading to be people what they can read for themselves so let’s move on to the code…   [Caveat: this is sample code.  This whole series on the blog is sample…

1