Hi,

 

I need to deploy my application to various environments using a central build server. I have created sample xml that list the files/folders to be copied in each environment.

 

I want to call this XML file though NAnt and use Nant script to run copy task based on the folders specific in xml. I am using server aliases which are also defined in the same xml.

 

Has anyone tried this approach before…what is the best scripting approach for this type of requirement? I am planning to write a C# function in NAnt script to read the xml and then use query using XPath. The first problem I see is how do run all the of copy commands. I looked into <foreach> task but it does not fit here. I need something like for loop where I can specify the number of iterations (I can read the number of copy commands using XPath).

 

Deployment.xml:

 

<?xml version="1.0" encoding="utf-8"?>

<deployment>

    <environments>

        <environment name="dev">

            <servers>

                <server alias="AppServer" machine="abcdev" />

                <server alias="WebServer" machine="xyzdev"  />

            </servers>

        </environment>

        <environment name="qa">

            <servers>

                <server alias="AppServer" machine="abcqa" />

                <server alias="WebServer" machine="xyzqa" />

            </servers>

        </environment>

        <environment name="prod">

            <servers>

                <server alias="AppServer" machine="abcprod" />

                <server alias="WebServer" machine="xyzprod" />

            </servers>

        </environment>

    </environments>

    <copycommands>

        <copy stopservice="AbcProcessing">

            <source>WindowsApp\AbcService\bin\release</source>

            <destination machinealias="AppServer">AbcService</destination>

        </copy>

        <copy>

            <source>WebApp\AbcWeb</source>

            <destination machinealias="WebServer">Inetpub\AbcWeb</destination>

        </copy>

    </copycommands>

</deployment>

 

I have this simple xml for project teams to specify the copy commands and then I want to put all the complexities in a common NAnt script.

 

Thanks in advance,

Sandeep

Reply via email to