Exploring MSBuild

time to read 2 min | 309 words

I'm trying to get a solid CI infrastructure at the moment, and I am trying to use MSBuild instead of NAnt. The main reason for this is that MSBuild is the format of VS 2005 projects, so I shouldn't have much to do beside run the project.

The problem starts when I want to do additional stuff. I created a new Default.build file to contain all the things that I want to happen outside of building the project itself (mainly because VS.Net complains if you manually edit the project file).

Now I am trying to generate a zip file from the build output and a configuration directory. I downloaded the community tasks and tried to generate a zip file, unsuccessfully. The issue is that I want the following format in the zip file:

·         Service:

o   Configuration:

§  Conf 1

§  Conf 2

o   Service.exe

o   NHibernate.dll

I couldn't get it to work, there is no way to tell the ZIP task to use hierarchies only on parts of the items. Then I tried to copy it to a temporary directory, and zip that. It worked, until I started creating/deleting the directory as part of the build process.

I used an ItemGroup called ZipFiles to give me all the files in the directory, and it looks like all the item groups are evaluated once, and when I tried to access ZipFiles, it evaluated already.

I solved this by moving it to another file (the project file, as a matter of fact), but I don't like it.

Isn't there a way to re-evaluate the item group with stuff that is generated at build time?