tags:

views:

466

answers:

3

Hi all,

I am just starting to look at MSBuild and get my head round the whole idea. I have setup a CI Server with Hudson and want to know how I "should" deal with build scripts and the sln / proj files.

For example I have an existing solution that has 10 projects in it, (one being a website and another being the web deployment project, and the setup MSI project). What is a good way of dealing with the building of this?

  1. should I just point msbuild at the sln file?
  2. Should I take what is in the SLN file and create another, so it points at the different proj files?
  3. Should I take the code from all the sln and proj files and create one custom build script?

If I do either of the last two, do I have to worry about maintaining two sets of scripts, i.e. making sure my script is upto date as well as the sln / proj files?

Also how do I deal with building it when developing on my local box? Do I just CTRL SHIFT B to build it and then only use the build script for the CI server / deployment builds?

Thanks for any and all help.

Jon

A: 

OK so,

I have been googling and found Jeff's post about "F5":

http://www.codinghorror.com/blog/archives/000988.html

From this and a couple of other posts I have decided that it would be best to create my own MSBuild script that is separate from the SLN and project files.

SCOTT HANSELMAN (Scott's Blog) had a good link about creating a shortcut in VS to run the build script. blog entry about parallel building

I am assuming that you need to still press F5 for debugging and can not avoid that scenario most the time, (asp.net can attach to a process so you do not have to keep doing this).

I am going to start by looking at the project files and building up a script from them, then customize to suit after that.

Hope this might help someone else looking around in the future.

Jon

Jon
+1  A: 

I tend to like the approach of, each project has it's own build file (whether it be msbuild or NAnt etc) and then there is a master build which builds all projects. That way you focus on project (eg while fixing a bug) and you run the master build before checking in plus the master.build is what gets run on the build machine.

You would still build and debug normally within VS, the build scripts are separate. The build scripts would be only for the build box and for running before checking in.

That's just my take on things. You may find my posting on getting started with CI useful...

Good luck!

wallismark
+1  A: 

Create a build script that runs an MSBuild task. Point the MSbuild task at your solution or project. Compiling your source code then becomes simple and is just another task. Your build script if free to focus on bigger and better things.

Your CI Server will run your build script. To run a build on a local machine include a .bat file in your project. The .bat file calls MSBuild to run your build script, and sets command line options for things like generating a log file. Then you can double click the bat file and look at the log file to see the results. Here is an example:

%WINDIR%\Microsoft.NET\Framework\v3.5\MSBuild.exe build.xml /fileLogger /fileLoggerParameters:LogFile=MSBuildLog.txt
mcdon