> From: Eric Fetzer [mailto:[EMAIL PROTECTED] 
> Services are my main concerns.  We have 2 different servers we are
deploying to,
> web and batch.  The Web side is less complicated, we can just do copies
over there.  
> On the batch side, though, we have several projects running as services
which is 
> why the developers feel strongly about the msi approach

We've found a great solution to the deployment issue. We use MSI files as
our distribution mechanism (we still build by shelling to devenv.exe
unfortunately, MSITask is still too complex, IMO) and then use some custom
tasks we built on top of WMI to deploy remotely to all our servers in all
our environments. We deploy one web project and multiple services. Here's
the core deployment task for the services (the web app deployment is even
easier):

        <target name="install">
                <servicecontrol 
                        machinename="${deploy.machine}"
                        servicename="${deploy.service.name}"
                        command="stop"
                        failonerror="false" 
                        />      
                <productuninstall machinename="${deploy.machine}"
packagename="${deploy.service.name}" failonerror="false"/>
                <productinstall 
                        machinename="${deploy.machine}" 
                        stagedirectory="${deploy.stage.dir}" 
                        packagepath="${deploy.package.base}\MainProduct.msi"

                        allusers="true"

                        />
                <productinstall
                        machinename="${deploy.machine}" 
                        stagedirectory="${deploy.stage.dir}" 
                        packagepath="${deploy.package.base}\COMProducts.msi"

                        allusers="true"

                        />
                <servicechange
                        machinename="${deploy.machine}"
                        servicename="${deploy.service.name}"
                        startname="${deploy.service.startname}"
                        startpassword="${deploy.service.startpassword}"
                        />
                <servicecontrol 
                        machinename="${deploy.machine}"
                        servicename="${deploy.service.name}"
                        command="restart" 
                        />
        </target>

The only pre-req is that you have admin privileges on the target boxes. This
has cut our production roll-out times from hours to minutes. 

The code is based on the stuff generated by the WMI VS.NET plug-in [1]. It
generates managed classes for WMI classes. From there, once we became
acquainted with WMI and its funky permissions model, we wrapped the
generated classes in NAnt tasks. There were some tweaks needed on the
generated classes.

This is a great way to get WMI functionality into NAnt quickly. In fact,
today, I wrote the Win32_Process task in order to install the hotfix for
MSBlast to all our dev and qa machines remotely. Four hours of grunt work
boiled down to 30 minutes of coding, what could be better!

The attached zip has the VS.NET project, generated classes and task classes.
So far, we've only scratched the surface of WMI. The following tasks are
included:
        Process
        ProductInstall
        ProductUninstall
        ServiceChange
        ServiceControl
        ServiceCreate
        ShareCreate

Unit tests and documentation are sparse, however it's a good start. Also,
it's built against the current stable release, not the 0.8.3 branch. If
you're interested, let me know and I'll send you the project (75KB).

-Brian

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmise/wmior
imanagementdatanode.asp


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to