MSBuild, refactor and targets in other files
October 20, 2008
I found a very niffty little feature of MSBuild, that is really helpful when it comes to structuring your build file.
In MSBuild the “sub-routines” are called targets and works just like expected, that is you can call the targets and invoke them in the order you like. BUT, there are no way of sending parameters to them - which at first are very hard to understand.
From this article I learned how to do it. And it’s not to hard. But it’s a bit of a hack… in my opinion.
Actually it’s easier to describe it as it’s intended from the outset, to call targets in other files. Imagine that you create a MSBuild-file called DeployScript.proj with a target called DeployIt. In order to deploy to different environments we use some variables that instructs MSBuild to deploy to different paths for example. Like the $(PublishWebSitePath) in the...