locked
Return codes for using MSDeploy with NAnt RRS feed

  • Question

  • User-587079950 posted

    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

    Tuesday, February 19, 2008 3:54 PM

Answers

  • User-1653247517 posted

    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

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, February 19, 2008 8:20 PM

All replies

  • User-1653247517 posted

    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

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Tuesday, February 19, 2008 8:20 PM
  • User-587079950 posted

    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.

    Wednesday, February 20, 2008 12:11 PM