views:

366

answers:

3

We maintain a medium sized windows application developed in vb/c# .net in work. Still now the build and deploy process for this app is manual. I am determined to make this process automated using MSBuild on which i have no knowledge still now.

Our app has a simple build structure, set of projects already grouped into four solutions(.sln) and just need to build the four slns in an order. And then publish a project(which is part of the last sln to be built) to a directory. That is it. A simple process which is already consuming 30 mins of manual build time and i'm pretty sure that this can be accomplished without manual interference using msbuild in atleast 1/4 th of the time.

All my goals set good, i started looking around web for MSBuild resources to accomplish my process but may be looking around many things confused me. Need a pointer or a good explanation on how to start and where to start for my simple scenario. Help is much appreciated.

+2  A: 

This sounds like a very easy script to write. Even a batch file would do:

msbuild \path\to\first.sln /p:Configuration=Release
msbuild \path\to\second.sln /p:Configuration=Release
msbuild \path\to\third.sln /p:Configuration=Release
msbuild \path\to\fourth.sln /p:Configuration=Release
call deploy

Of course, much better would be to have a server running, say CruiseControl.NET, that gives a web interface into the build status and history.

In MS Build, there are two main control points for the caller: The Target and its Properties. The Target is what to compile, resources, compilation, deployment, etc. The Properties control how that Target is built.

You can control the configuration using the Configuration property (see above). If you open your .proj files, you will notice PropertyGroup elements. These are settable via the commandline using the /p arg.

Here are the specs for the two args:

/target:<targets>  Build these targets in this project. Use a semicolon or a
                 comma to separate multiple targets, or specify each
                 target separately. (Short form: /t)
                 Example:
                   /target:Resources;Compile

/property:<n>=<v>  Set or override these project-level properties. <n> is
                 the property name, and <v> is the property value. Use a
                 semicolon or a comma to separate multiple properties, or
                 specify each property separately. (Short form: /p)
                 Example:
                   /property:WarningLevel=2;OutDir=bin\Debug\
Frank Krueger
Thanks for your reply. But how do i set configuration options and all? For e.g i debug my app setting projs in DEbug mode but the script should always build in Release mode. Thanks again for your quick reply.
blntechie
I have added details. It's all quite simple and well worth mastering. MS Build can automate **a lot**.
Frank Krueger
+1  A: 

Here's a good guide that has a lot of great information on MSBuild, Continuous Integration and CuriseControl.NET. Definitely a good place to start.

JP Alioto
+1  A: 

Hi, If you are looking for MSBuild info on the web here are a couple places to start

If you are looking for a book, you can grab mine. The link is below my name.

Sayed Ibrahim Hashimi