views:

607

answers:

2

I have 3 MSBUild scripts for deployment, 1 for deploying UI 1 for deploying a couple of web services. 1 for deploying backend services.

Now I would like to create a one click deployment MSBuild script, which would call all the above 3 scripts, which can be executed from a TeamCity server.

So how can I call these three MSBuild scripts from a different MSBuild Script.

+3  A: 

There is a MSBuild MSBuild task.

OregonGhost
A: 

I have not used TeamCity Server, but one possible alternate solution is to combine the three build scripts into one script. And put tasks of the three separate scripts into separate targets in the master build file. So, instead of the three separate build scripts, you have one build script with three targets, namely deployUI, deployServices, deployBackend. Untested sample below:

    <?xml version="1.0" encoding="utf-8" ?>
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="DefaultTarget" ToolsVersion="3.5">

    <Target Name="DefaultTarget">
            <CallTarget Targets="deployUI" ContinueOnError="false"></CallTarget>
            <CallTarget Targets="deployServices" ContinueOnError="false"></CallTarget>
            <CallTarget Targets="deployBackend" ContinueOnError="false"></CallTarget> 
    </Target>

    <Target Name="deployUI">
            <!-- Put UI deployment tasks here -->
    </Target>

    <Target Name="deployServices">
            <!-- Put Services deployment tasks here -->
    </Target>

    <Target Name="deployBackend">
            <!-- Put Backend deployment tasks here -->
    </Target>
</Project>
desigeek
This is a valid option to merge all the 3 components, but I want the ability to deploy the components independently if I choose to, an do not want to duplicate the build script content in two scripts.
Pradeep
You have the ability to deploy components individually by using conditional statements within the build file. If you use conditional statements, then you don't have to maintain duplicate script files either. just provide the correct target while calling the build file and you are done.
desigeek
Sidenote: I am not sure how the accepted answer helps? In the mentioned task I do not see a way to call build files/scripts which is what your questions asks for. The MSBuild task allows you to build projects with some options, but you wanted to build using build files which most likely will do other things than just compile and deploy (for example updating related config files). In that case using just the MSBuild task will not work. Let me know if I am missing something.
desigeek