5

I've added the following skip rule to my project but when I use Web Deploy to publish the contents, the files in the /config folder are being wiped out.

I'm using the process found here and I swear it was working previously.

I've added the following to my project file:

<PropertyGroup>
    <OnBeforePackageUsingManifest>AddCustomSkipRules</OnBeforePackageUsingManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
    <ItemGroup>
      <MsDeploySkipRules Include="SkipConfigFolder">
        <SkipAction>Delete</SkipAction>
        <ObjectName>dirPath</ObjectName>
        <AbsolutePath>.*\\config\\$</AbsolutePath>
        <XPath></XPath>
      </MsDeploySkipRules>
      <MsDeploySkipRules Include="SkipConfigSubFolders">
        <SkipAction>Delete</SkipAction>
        <ObjectName>dirPath</ObjectName>
        <AbsolutePath>.*\\config\\.*$</AbsolutePath>
        <XPath></XPath>
      </MsDeploySkipRules>  
    </ItemGroup>
</Target>

When I publish (via command-line using the cmd file generated by the package), the following is outputted:

-------------------------------------------------------
 Start executing msdeploy.exe
-------------------------------------------------------
 "C:\Program Files\IIS\Microsoft Web Deploy V2\\msdeploy.exe" 
   -source:package='<MyPackageFile>' 
   -dest:auto,includeAcls='False' 
   -verb:sync 
   -disableLink:AppPoolExtension 
   -disableLink:ContentExtension 
   -disableLink:CertificateExtension 
   -skip:skipaction='Delete',objectname='dirPath',absolutepath='.*\\config\\$' 
   -skip:skipaction='Delete',objectname='dirPath',absolutepath='.*\\config\\.*$' 
   -setParamFile:"<MySetParameters.xml>"
Info: Deleting filePath (Default Web Site/uPPK_32\config\New Text Document.txt).

It looks like the skip rule is being added but notice New Text Document.txt is being deleted. How can I prevent this? Am I missing something?

Ben Ripley
  • 2,115
  • 21
  • 33
  • Hi Ben.Could you fix it? I'm having the same problem! – fcaldera Nov 23 '12 at 16:19
  • I haven't found a solution. I've moved on for now but I would love to understand why this doesn't work. I will post a fix here if I find one... :) – Ben Ripley Nov 23 '12 at 17:07
  • My understanding is that these SkipRules are not run when using Package/Web Deploy, see: https://stackoverflow.com/a/5659390/1339347 – uniquelau Feb 07 '18 at 12:48

2 Answers2

3

I think your second skip line needs to use filePath instead of DirPath, as you're selecting files there.

Paul Smith
  • 1,044
  • 2
  • 13
  • 29
3

The values of the absolutePath attributes are regexes, so you probably want a value like '\\config' or '\\config$' instead of the values for the two example skip settings shown in your question.

Kenny Evitt
  • 9,291
  • 5
  • 65
  • 93