Good-practices: How to reuse .csproj and .sln files to create your MSBuild script for CI ?
Posted
by Gishu
on Stack Overflow
See other posts from Stack Overflow
or by Gishu
Published on 2010-06-18T05:03:46Z
Indexed on
2010/06/18
5:13 UTC
Read the original article
Hit count: 449
What is the painless/maintainable way of using MSBuild as your build runner ? (Forgive the length of this post)
I was just trying my hand at TeamCity (which I must say is awesome w.r.t. learning curve and out of the box functionality). I got an SVN > MSBuild > NUnit > NCover combo working.
I was curious as to how moderate to large projects are using MSBuild - I've just pointed MSBuild to my Main sln file. I've spent some time with NAnt some years ago and I found MSBuild to be a bit obtuse. The docs are too dense/detailed for a beginner.
MSBuild seems to have some special magic to handle .sln files ; I tried my hand at writing a custom build script by hand, linking/including .csproj files in order (such that I could have custom pre-post build tasks). However it threw up (citing duplicate target imports). I'm assuming most devs wouldn't want to go messing around with msbuild proj files - they'd be making changes to the .csproj and .sln files. Is there some tool / MSBuild task that reverse-engineers a new script from an existing .sln + its .csproj files that I'm unaware of ?
If I'm using MSBuild just to do the compile step, I might as well use Nant with an exec task to MSBuild for compiling the solution ? I've this nagging feeling that I'm missing something obvious.
My end-goal here is to have a MSBuild build script
- which builds the solution
- that acts as a build script instead of a compile step. Allows custom pre/post tasks. (e.g. call nunit to run a nunit project (which seems to be not yet supported via the teamcity web UI))
- stays out of the way of the developers making changes to the solution. No redundancy ; shouldn't require devs to make the same change in 2 places
© Stack Overflow or respective owner