Previous Next

Thread: Return codes for using MSDeploy with NAnt

Last post 02-20-2008 12:11 PM by Mark Nyon. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 02-19-2008, 3:54 PM

    Return codes for using MSDeploy with NAnt

    Hi,

    I've been playing with the Deployment Tool for the past few days and have generally liked it. I had a question about exclusions in the custom manifests, but I worked around that by using an NAnt <exec> task and passing -skip arguments from the command line. I wanted to know if msdeploy returns any value besides 0 on failure. As a test that I expected to fail, I changed the password on a remote operation. Calling msdeploy from NAnt with the following build file:

       <exec program="C:\Program Files\Microsoft Web Deploy\msdeploy.exe"
            append="true"
            output="C:\inetpub\logs\msdeploy_to_qa.log"
            resultproperty="msDeployReturnCode"
            failonerror="false"
            workingdir="C:\Program Files\Microsoft Web Deploy\">
        <arg value="-source:dirPath=C:\ccnet\stage\crm-core\source"/>
        <arg value="-dest:dirPath=C:\inetpub\wwwroot\app\upswing,targetName=http://HOST/MSDEPLOY/,username=<USERNAME>,password=<WRONG_PASSWORD"/>
        <arg value="-verb:sync"/>
        <arg value="-skip:objectName=filePath,absolutePath=.*web\.config"/>
      </exec>

    From within Nant, msdeploy returned the following:

     

         [exec] Fatal: Failed to get systemInfo object. The remote server returned a
    n error: (401) Unauthorized.
         [exec] Change count: 0
         [exec] Fatal count: 1
         [echo] Return Code = 0

     

    I have three questions;

    1) Are there conditions that cause msdeploy to return a code besides 0?

    2) Can msdeploy be changed to return multiple error codes, so that those can be caught and reported?

    3) Is there another way to do this that I'm missing?

     

    Thanks in advance,

    Mark

  • 02-19-2008, 8:20 PM In reply to

    • ksingla
    • Top 10 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 562

    Re: Return codes for using MSDeploy with NAnt

    Mark,

    Here are answers to your questions.
    1. Currently msdeploy.exe always return code 0.
    2. Yes, that can be done. I will follow up on this request.
    3. No, you can't rely on return codes to detect failures. Only thing possible is parse the output to find fatal count etc.

    Thanks,
    Kanwal

  • 02-20-2008, 12:11 PM In reply to

    Re: Return codes for using MSDeploy with NAnt

    1. Doh!

    2.  Thanks. I look forward to hearing more.

    3.  Okay, I'll parse the output and return a success or failure based on the number of fatal errors.

Page 1 of 1 (3 items)
Page view counter