msbuild-overview
Just some notes on msbuild
General process on buildserver
- Checkout: Checks out the latest source into the build directory.
- Build: Uses MSBUILD to build the project, do appropriate versioning and run the unit tests
- Package: Creates a set of the binaries, scripts and documentation in an installable form (eg zip, msi, exe)
- Smoke Test: Deploys the package on the build server and runs the integration tests
- Deploy: Update deployment in subsequent environments (eg test)
Build smells
- one package per environment/configuration
- (environment) configuration included in the package
- database migrations are not scripted
- need to install too much software in each environment for installation
- unable to rollback installs
- building release packages not from the buildserver
- inability to run multiple versions in one environment
Install lifecycle
- download package
- first time install setups (eg database instance, aliases, credentials)
- click-to-install upgrades from then on
Key things to learn with MSBUILD
- basic syntax of targets (see msdn)
- command line invocation (see command line and response files)
- specifics of Item Groups as these are key to harnessing msbuild power (see well-know item meta-data)
- finding tasks in external libraries (extensionspack, sdc, communitytasks – see references below)
Advanced topics
- known meta data (eg http://msdn.microsoft.com/en-us/library/ms164309%28VS.80%29.aspx)
- modularising and reusing msbuild tasks
- removing dependencies on visual studio (eg devenv by checking copies of common.targets)
Other goodies
- linking into buildserver with environment variables (eg on TeamCity)
- executing from visual studio
- creating bat/cmd files
Clear shortfalls
- strong naming/process conventions (cf ant or make)
- flat namespace for reuse across multiple packages (cf rake)
- no real conventions for private members (cf ant)
- no real support for self-documenting targets (cf ant or rake)
- provides functionality that is often counter intuitive at first (but powerful after learning and frustration)
References:
- MSBUILD reference on MSDN
- msbuild extension pack – probably this is the best set currently (documentation isn’t always the best) for later libraries like IIS7 or BizTalk
- SDC tasks – good documentation to understand extension pack!
- msbuild community tasks – original set of tasks – still some goodies like SVN tasks