Thursday, August 21, 2008

One line to build them all

Did you ever wake up at midnight asking yourself "how do I build I2B without having visual studio?" everybody does. I finally found an elegant way to build our solution from the command line. The simplest way to build a solution from command line is using "devenv.exe Spacecrafts.sln /build" but this required Visual Studio to be installed. However, there is a tool called MSBuild that comes with .NET framework 2.0 that can do the job.

Here is how the command would look like on my machine:

[WinDrive]:\Windows\Microsoft.NET\Framework\v2.0.50727\msbuild Spacecrafts.sln /t:Rebuild /p:Configuration=Debug /l:FileLogger,Microsoft.Build.Engine;logfile=BuildLog.log

What this will do is build the whole project and save a log file called "BuildLog.log". I saved this to a batch file so that it's convinient to use. And now we can all sleep in peace.

Why do we need this? If we are going to have a build server, then we need a simple command to execute to build the whole thing. I have not yet set up a build server, but I am on my way. I still need to find out how to automate this whole process of checking SVN and tracking build results.

No comments: