John Lam has a nice doc about MSBuild, Microsoft's XML based build system of the next Visual Studio version. This issue has far more information than has publicly been available yet.

You may need a Windows machine running Acrobat Reader to read it as both xpdf on Linux and preview on MacOS X seem to be lacking the fonts necessary for it.

path: /en/dotNet/msbuild | #

Alex Kipman posts pointers to an online version of chapter 2 of Brent Rector's book.

The part talking about Ant and NAnt has been completely rewritten and now looks a lot nicer and more informed than the original version (search for the English language text under TLS347).

I'm sure Alex has played a significant role in this and want to thank him - as well as I want to thank Brent for reconsidering the section.

Brent's main point now is that Ant places the burden of timestamp based dependency tracking on task writers, I think I've addressed this already. I obviously still think that Ant's choice is the better one 8-)

The other point is about "build scripts" vs. "project manifest", that I'll have to think about a bit more.

path: /en/dotNet/msbuild | #

In Target Dependencies in MSBuild vs. Ant I claim that Ant's model was more powerful than the file name based approach taken by make and MSBuild's target inputs/outputs dependencies.

Let me give some reasons:

Like I previously said, you can create smart tasks in MSBuild as well. But if you start out with the target input/output checking in your build file, switching to smarter tasks may become a steep learning curve. You may even have to implement them yourself when the shipped tasks are not smart enough.

path: /en/dotNet/msbuild | #

If you should be reading Brent Rector's "Introducing Longhorn for Developers" by Microsoft Press that has been handed out at PDC apparently, make sure you also read what a Program Manager of Microsoft's Visual Studio Core Team says about the NAnt chapter.

Update: a revised version of the chapter is now online at MSDN and this will be the version that's going to appear in press.

path: /en/dotNet/msbuild | #

Last post on MSBuild for today, promised.

MSBuild supports something called Item. This is basically the same as a data-type with an id attribute in Ant. Its main use in MSBuild is to specify inputs and outputs of tasks and targets - in Ant the references are only used for task inputs.

While I don't like the inputs/outputs for Target too much, I think the idea to have a task accept a reference as input and provide its output as a reference is useful. For some tasks it may be difficult to calculate the output, if possible at all, but as a general concept this may work.

The input for tasks like <copy> could be some type of file-collection, as would be the output. Let's assume we want to copy some files and add those that we've just copied to an archive.

What we'd do with Ant now

  <fileset id="templates" dir="styles">
    <patternset id="template-patterns">
      <include name="**/*.xsl"/>
    </patternset>
  </fileset>
  <copy todir="${build}">
    <fileset refid="templates"/>
  </copy>
  <zip destfile="files.zip">
    <fileset dir="${build}">
      <patternset refid="template-patterns"/>
    </fileset>
  </zip>

Let's assume all task can specify inputs (<copy> and <zip> would accept <fileset> among other things as inputs) and outputs via inputItems and outputItems attributes respectively. inputItems points to an existing project reference, outputItems creates such a reference.

Then we could write:

  <fileset id="templates" dir="styles">
    <include name="**/*.xsl"/>
  </fileset>
  <copy todir="${build}" inputItems="templates" 
        outputItems="copy-of-templates"/>
  <zip destfile="files.zip" inputItems="copy-of-templates"/>

We could even create a special TaskContainer that magically connected the output of task n to the input of task n+1, avoiding temporary references like "copy-of-templates":

  <fileset id="templates" dir="styles">
    <include name="**/*.xsl"/>
  </fileset>
  <pipe>
    <copy todir="${build}" inputItems="templates"/>
    <zip destfile="files.zip"/>
  </pipe>

Something that needs more thought, of course.

path: /en/dotNet/msbuild | #