I don’t believe there’s a specific task, so we do something like this:


            <target name="InstallService">


                                    Check if the service is already installed.

                                    ServiceController will error if we try to control a non-existent service.


                        <if test="${service::is-installed(svc.name, '.')}">

                                    <!-- Stop the service if necessary. MSIEXEC seems a little hesitant to do it itself -->

                                    <if test="${not service::is-stopped(svc.name, '.')}">

                                                <servicecontroller machine="." service="${svc.name}" action="Stop" />




                        <echo message="Installing ${path::combine(setup.dir, svc.msi)}" />

                        <!-- Call MSIEXEC to install the desired MSI package in quiet unattended mode -->



                                    commandline="/package ${path::combine(setup.dir, svc.msi)} /passive /qn"



                        <!-- Start the service. MSIEXEC seems a little hesitant to do it itself -->

                        <servicecontroller machine="." service="${svc.name}" action="Start" />



You’ll need NAntContrib to run some of these tasks. It’s reasonably parameterised – just set svc.name and svc.msi to the name of the Windows service and the name of the .msi package respectively before calling the target; it works well for us with three services to install.



David Keaveny


From: nant-users-bounces@lists.sourceforge.net [mailto:nant-users-bounces@lists.sourceforge.net] On Behalf Of Deepak Surendran
Sent: Friday, 18 May 2007 4:01 PM
To: NANT Mailing List
Subject: [NAnt-users] Infomation Required


Using NANT file i am able to create MSI for my project. Whether is it possible to install the MSI automatically using NANT file.
I have automated the nant build file in our build server.It will create the MSI in our build server.So every time we have to install the MSI manually. Is there is any way to install the MSI automatically .
Deepak S