Custom MSBuild tasks to clone Git repositories and more…
Every good work of software starts by scratching a developer's personal itch.I love Git. I like the way it completely changed my way of thinking about version control. It has completely replaced Subversion for my personal projects.
Eric Raymond – The Cathedral and the Bazaar
I also love MSBuild. It is in my opinion an underappreciated, flexible, extensible and relatively unknown technology that can handle all your build problems. It is my first choice as a build tool for all continuous integration projects.
MSBuild is effectively an untyped Lisp-2 with ugly XML syntax
snprbob86 on Reddit
MSBuild does have community tasks that integrate with different version control systems, but Git is not one of them. (The Git love is spreading slowly in the Windows community…)
What else to do but write my own custom MSBuild tasks that integrate with Git? So, I present MSBuildGitTasks
A typical use case for MSBuildGitTasks in my MSBuild projects:
- Clone a Git repository onto the build computer.
- Switch to a specific branch in the newly cloned local repository.
- Retrieve the SHA from the latest commit in that branch (to be used as version information for the build).
- Start compiling…
I consider this a 0.1 release. It works for my workflow and my combination of hardware/software. That said, the software is extremely simple and should be easy to grok.
Have fun and happy coding!