How do I get MSDeploy to skip specific folders and file types in folders as CCNet task

Posted by Simon Martin on Stack Overflow See other posts from Stack Overflow or by Simon Martin
Published on 2012-06-22T08:40:25Z Indexed on 2012/06/24 3:16 UTC
Read the original article Hit count: 349

I want MSDeploy to skip specific folders and file types within other folders when using sync. Currently I'm using CCNet to call MSDeploy with the sync verb to take websites from a build to a staging server. Because there are files on the destination that are created by the application / user uploaded files etc, I need to exclude specific folders from being deleted on the destination. Also there are manifest files created by the site that need to remain on the destination.

At the moment I've used -enableRule:DoNotDeleteRule but that leaves stale files on the destination.

<exec>
        <executable>$(MsDeploy)</executable>
        <baseDirectory>$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\</baseDirectory>
        <buildArgs>-verb:sync 
           -source:iisApp="$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\" 
           -dest:iisApp="$(website)/$(websiteFolder)"
           -enableRule:DoNotDeleteRule</buildArgs>
        <buildTimeoutSeconds>600</buildTimeoutSeconds>
        <successExitCodes>0,1,2</successExitCodes>
</exec>

I have tried to use the skip operation but run into problems. Initially I dropped the DoNotDeleteRule and replaced it with (multiple) skip

<exec>
        <executable>$(MsDeploy)</executable>
        <baseDirectory>$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\</baseDirectory>
        <buildArgs>-verb:sync 
            -source:iisApp="$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\" 
            -dest:iisApp="$(website)/$(websiteFolder)"
            -skip:objectName=dirPath,absolutePath="assets" 
            -skip:objectName=dirPath,absolutePath="survey" 
            -skip:objectName=dirPath,absolutePath="completion/custom/complete*.aspx" 
            -skip:objectName=dirPath,absolutePath="completion/custom/surveylist*.manifest" 
            -skip:objectName=dirPath,absolutePath="content/scorecardsupport" 
            -skip:objectName=dirPath,absolutePath="Desktop/docs" 
            -skip:objectName=dirPath,absolutePath="_TempImageFiles"</buildArgs>         
        <buildTimeoutSeconds>600</buildTimeoutSeconds>
        <successExitCodes>0,1,2</successExitCodes>
    </exec>

But this results in the following:


Error: Source (iisApp) and destination (contentPath) are not compatible for the given operation.
Error count: 1.

So I changed from iisApp to contentPath and instead of dirPath,absolutePath just Directory like this:

<exec>
    <executable>$(MsDeploy)</executable>
            <baseDirectory>$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\</baseDirectory>
    <buildArgs>-verb:sync 
        -source:contentPath="$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\" 
        -dest:contentPath="$(website)/$(websiteFolder)"
        -skip:Directory="assets" 
        -skip:Directory="survey" 
        -skip:Directory="content/scorecardsupport" 
        -skip:Directory="Desktop/docs" 
        -skip:Directory="_TempImageFiles"</buildArgs>           
    <buildTimeoutSeconds>600</buildTimeoutSeconds>
    <successExitCodes>0,1,2</successExitCodes>
</exec>

and this gives me an error: Illegal characters in path:

< buildresults>
Info: Adding MSDeploy.contentPath (MSDeploy.contentPath).
Info: Adding contentPath (C:\WWWRoot\MySite
-skip:Directory=assets
-skip:Directory=survey
-skip:Directory=content/scorecardsupport
-skip:Directory=Desktop/docs
-skip:Directory=_TempImageFiles).
Info: Adding dirPath (C:\WWWRoot\MySite
-skip:Directory=assets
-skip:Directory=survey
-skip:Directory=content/scorecardsupport
-skip:Directory=Desktop/docs
-skip:Directory=_TempImageFiles).
< /buildresults>

< buildresults>
Error: Illegal characters in path.
Error count: 1.
< /buildresults>

So I need to know how to configure this task so the folders referenced do not have their contents deleted in a sync and that that *.manifest and *.aspx files in the completion/custom folders are also skipped.

© Stack Overflow or respective owner

Related posts about continuous-integration

Related posts about cruisecontrol.net