Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good tutorial on MSBuild scripts? [closed]

I'm working on a web application project, and I need to create a build script; a build script that I can trigger from my cruisecontrol server. Since nant has not been maintained for ages, I figure that MSBuild is the way to go.

I need the build script to be able to

  • Compile all assemblies
  • Execute unit tests
  • Run NCover analysis on the unit tests
  • Deploy the database (depending on parameters). This is really executing a tool since I will end up writing my own tool to deploy the database. But the execution of the tool should be conditional based on some command line parameter.
  • Deliver unit tests and coverage results in a format that cruisecontrol can read and understand.

I assume that MSBuild will allow me to do all these things. But I don't know where to start. Does anybody know of a good tutorial to get me started with my build script?

like image 475
Pete Avatar asked Aug 25 '09 06:08

Pete


People also ask

What is MSBuild script?

MSBuild is the build platform for Microsoft and Visual Studio. This walkthrough introduces you to the building blocks of MSBuild and shows you how to write, manipulate, and debug MSBuild projects. You will learn about: Creating and manipulating a project file.

Is MSBuild needed?

msbuild is used when you want to build your project from the command line. Whenever you see a continuous integration product that will automatically build your project, it will call msbuild to perform the actual build step.

How do I run MSBuild from command prompt?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.


3 Answers

This was my first tutorial. Very easy to understand and follow:

https://codingcockerel.wordpress.com/2008/04/15/automating-the-build-with-msbuild/

like image 57
Punit Vora Avatar answered Oct 17 '22 02:10

Punit Vora


Start here : http://brennan.offwhite.net/blog/2006/11/29/msbuild-basics-1of7/

like image 38
Preet Sangha Avatar answered Oct 17 '22 02:10

Preet Sangha


There is a "Getting Started with MSBuild" blog post on the the Visual Studio Blog which gives a good overview on how MSBuild is hooked up with Visual studio. It's fairly recent (25.02.2010) and uses Visual Studio 2010 and the accompanying MSBuild v4.0.

There is not much code there though.

It wasn't until reading this blog that I understood that the *.csproj files themselves are MSBuild files. And also, that the Build, Clean, Rebuild and Publish command in the project context menu actually are MSBuild "targets".

like image 9
Lernkurve Avatar answered Oct 17 '22 04:10

Lernkurve