Hi,
I've been using basic WebDeploy (understand VS deployments) for some time and am very happy with it.
However, I'm faced with a problem I can't resolve:
I want to deploy a WebDeploy package to an IIS box. Problem is I want to keep some folders in the folder where the package will be deployed.
As an example, here's the hierarchy of the root folder:
- App_Data
- bin
- ...
- Documents
- To Keep
- To Delete
Alright, I want the deployment to keep the "Documents\To Keep" folder intact and not delete it, so I came up with the following skip directive:
msdeploy [arguments here] -skip:Directory=".*\\Documents\\To Keep$"
Here's the output when I run the command with the -whatif flag
Info: Object dirPath (Default Web Site/MyWebSite\Documents\To Keep) skipped due to skip directive 'CommandLineSkipDirective 1'. Info: Deleting directory (Default Web Site/MyWebSite\Documents\To Delete). Info: Deleting directory (Default Web Site/MyWebSite\Documents).
The two first lines are the behavior I expect. But the third... WebDeploy tries to delete the parent folder of the one I specified to NOT delete, and fails to do so if I remove the -whatif flag, I guess because the Documents folder is not empty.
I then tried to include another skip directive to prevent the Documents folder to be deleted, like this:
msdeploy [arguments here] -skip:Directory=".*\\Documents\\To Keep$" -skip:Directory=".\\Documents$"
but then the output is the following:
Info: Object dirPath (Default Web Site/MyWebSite\Documents) skipped due to skip directive 'CommandLineSkipDirective 2'.
I also tried changing the order of the skip directives, but it didn't change anything.
I'm struggling on this one, I found a similar case on
this thread, but there was no answer.
Thanks in advance, I hope there's a way to achieve this.
Sincerely,
Mickaël