-=//mawi.org//=-
 Thursday, July 20, 2006
(or "MSBuild sucks at solutions - one simple proposal you can try")

MSbuild is a product with some great advantages, the foremost being the flawless IDE integration. However, it does have some weaknesses - one being the weak solution story.

Sample of stuff you cannot do with MSBuild without resorting to hacks:

- Theres no story for executing something just before a compile actually happens
- You cannot set up anything to happen at the end of a solution build
- The API (object model) is weak, you cannot even get a hold of the currently executing project (!).
From there on it just gets worse.

This is by design - you are not supposed to operate on the context and there seems to be no way to set up any state for the currently executing solution build.

The solution story is very weak, it generates a project in memory from the old syntax, and you cannot really access it - to set up solutionwide properties, imports, hook into the process, etc.

The general idea of having a very clear and limited interface towards tasks is naturally good, and would work if the solution story was stronger - and in line with the rest of the design. Since it is this way however, many things prove difficult to accomplish.

Ugly hack it! There have been proposed solutions using wrappers, but those are unusable in the IDE, which again really is the forté of msbuild. If we don't get IDE integration there are other solutions (SCONS, rake) that beat msbuild with one hand behind their backs. So one option is to put state into environment vars (pretty, aint it - gets that 80's smell back into the room). If you want static properties you can meddle with the files in the framework (system) directory, but in many companies that is not a tolerated option.

When confronted by a problem such as this, I usually have faith in the designers and start researching - banging my head against the wall trying to find an appropriate solution. This time was no different. Then comes the realization phase that there is actually no way forward by means of the intended uses. You step back...

My proposed solution is simple; for me the problem was essentially twofold - I wanted to be able to keep state that all projects could share over the course of a solution build, and I wanted to hook into the start and end of the solution build process. My idea: Create a singleton that stores state over the life of the appdomain and a set of tasks that allow the projects to interact with it.

1. For state there are tasks that allow you to get and set data
2. For hooks there is an initialized flag and a task to set it as you set data, and then there is a task by which you may retrieve the value of the flag.

In order to use this alternative, you are only required to put an import into each project file - which seems to be the standard and least obtrusive way of mopdifying the build process (analoguous to MSBee).

Note that this is still a hack! Why? First, it doesnt adhere to the design of MSBuild, with very clearcut interfaces between tasks, targets, etc (although, that is the problem since MSBuild is half baked, see above). Second, the end-of-solution targets are called from a destructor - which is bad (read up on who executes the destructor and how to find out why it is bad, save for the fact that it is conceptually bad). So this is at best an interim way to get things done - the first thing I could think of.

The best way to see how this works is to download the src zip, and open it up in visual studio (or just review the example test solution). It has a test solution that you can run (F5) and examine it to see how to use this little piece of code.

Please get back to me if there are bugs, improvements or maybe better/cleaner ways of accomplishing what I want.

Known issues: No logging when "end of solution" target runs.

SolutionUtilTasksSrc.zip (128.36 KB)

SolutionUtilsBin.zip (11.23 KB)
7/20/2006 10:52:29 AM (Romance Daylight Time, UTC+02:00)  #    Comments [2]  |  Trackback
 Monday, July 17, 2006
(The iteration demo)

Jim Shore has put up yet another text from his upcoming book ("The Art of Agile Development") for review on his blog. This time he talks about the iteration demo: A live demonstration of what has been accomplished during the last iteration, that can be attended by anyone that is interested. Jim describes the demo as a "way to keep the momentum going" and lists three purposes to the iteration demo: (1) Demonstrating progress, (2) keeping the team honest about progress and (3) soliciting feedback from interested parties and stakeholders.

I feel that an essential benefit of the iteration demo is how it portrays progress and instills the feeling of momentum in the team. Agile development can actually suffer from the way progress is flows in tiny increments, making it difficult for developers to perceive the speed and momentum of the progress. This may make the team feel that there is little momentum and that little happens - since everything evolves so incrementally. It's like when you watch some slow movement, such as watching clouds on a calm day, trying to discern what direction they are moving in with no fixed reference point: It is not immediately apparent.

However, to someone outside the project, the progress made over one week is obvious, since (presumably) a great deal has happened since the last reference point (the last review of the product). Again, if one were to mount a camera at the sky and take pictures at longer intervals, movement would be immediately obvious.

When an outside stakeholder reviews progress, there is commonly a strong positive reaction - "wow, all of this has been created since last time? Cool!" When developers see this emotion, it is "transferred" to them - they effectively experience the feeling of momentum and progress via the reviewers of the demonstration.

The negative effect of *not* perceiving progress and the momentum of a project is great - a project that is taking great strides forward feels successful, and causes team members to be substantially more productive. The iteration demo is a device that allows a team to get that valuable feeling and productivity.

7/17/2006 4:23:43 PM (Romance Daylight Time, UTC+02:00)  #    Comments [0]  |  Trackback
 Thursday, June 01, 2006

I was pleased to notice that so many had not had the opportunity to get up to speed on continuous integration before our talk yesterday. Of all the people in the auditorium only 2-3 felt they knew what all the "hoopla" is about.

Even though we could have used the full fifty minute slot, I think that we managed to cover the essence - although there is so much more there in the form of experiences and perspectives to talk about.

As promised here is the presentation slidedeck. Since it was so heavy on images I have made them smaller, although this download is still large (6mb).

Links to good articles - the web is naturally full of both good and bad, but don't miss these:

On the conference:
We had a great time at Developer Summit 2006 in Kista, Stockholm. I applaud all the great guys and gals at Cornerstone for managing to create such a cozy gathering!

The first day started out with an interesting overview of mashups and the semantic web. Erik did a great top 10 developer donts kind of thing that I enjoyed very much - highlighting best practices, many of which are reexposed in agile. After lunch, Jimmy did TDD and we got a nice agile progression going upto my CI talk. The second day highlights for me was probably Manges entertaining causerie on Web 2.0 and an entertaining overview of open source development in .NET by Mats Helander. Patrik did WF and Johan a potpourri of coming VS.NET stuff.


Lets hope we get the same kind of event next year. For more conference and development fun this year, keep your eye on Öredev scheduled for November.


6/1/2006 11:07:25 AM (Romance Daylight Time, UTC+02:00)  #    Comments [0]  |  Trackback
 Monday, May 22, 2006

If you are migrating to VS.NET 2005 and converting projects, the VS.NET conversion wizard will do that for you. Then you can use MSBee to compile into both 1.1 and 2.0 assemblies.

 

However, if you are migrating the build process perhaps before all projects in your organization have migrated, people will still be developing in VS.NET 2003 for some time, yet you want to have a standardized build process, around MSBuild.

 

This little MSBuild task will convert a VS.NET 2003 project on the fly so that you can use MSBuild to compile it.

 

Pretty niche scenario, yet since I found myself there, others probably will too.

 

It is easy to use, you just slap a Using element and then use the task, giving it the projects name. Thats it. Installation is xcopy. The readme gives step-by-step instructions. Happy building!

ConvertTo2005.zip (10.87 KB)
5/22/2006 2:28:46 PM (Romance Daylight Time, UTC+02:00)  #    Comments [1]  |  Trackback
 Sunday, May 21, 2006
Agile methods focus on the people issues in developing software; the people perspective of the open source movement - ie the community - is often the perspective that is most emphasized and cherised, for good reason. People are always the focus, technology is secondary.

Rob Mensching at microsoft (who is behind MS open source - CPL - licensed WIX installer toolkit) has a very nice post about the people part of OSS.
5/21/2006 5:18:37 PM (Romance Daylight Time, UTC+02:00)  #    Comments [0]  |  Trackback