Skip rules in .configsettings not workingRSS

3 replies

Last post Aug 20, 2020 09:55 AM by GHausammann

‹ Previous Thread|Next Thread ›
  • Skip rules in .configsettings not working

    Aug 03, 2018 10:22 AM|mrmiles|LINK


    I am trying to add a skip rule to the .configsettings file on my server, so deployments will never delete files inside App_Data

    I added these two, based on the example within the file itself, to the rules section:

    <rule name="AppDataFiles" type="Microsoft.Web.Deployment.DeploymentSkipRuleHandler" objectName="filePath" skipAction="Delete" absolutePath="//App_Data//.*"/>
    <rule name="AppDataFolders" type="Microsoft.Web.Deployment.DeploymentSkipRuleHandler" objectName="dirPath" skipAction="Delete" absolutePath="//App_Data//.*"/>

    But now when I run msdeploy, it just says (in red)

    Error: Object reference not set to an instance of an object.
    Error count: 1.

    and fails.  I've tried different escapings in absolutePath, a different string for the type, and commenting out one or both of the rules completely.  Everything works fine with the rules both commented out, but this error appears otherwise consistently.

    What's the correct way to do this?  To be clear, I want this to be a server setting rather than a command line deployment argument.



  • Re: Skip rules in .configsettings not working

    Aug 06, 2018 06:21 AM|deepakpanchal10|LINK

    Hi mrmiles,

    Are you using RC version of MS Deploy?

    As per my search results, You need to define the rule in both msdeploy,exe,configsettings and msdepsvc.exe.configsettings on the remote machine.

    <rule name="DoNotDeleteFilesOnDestination" type="Microsoft.Web.Deployment.DeploymentSkipRuleHandler" objectName="filePath" 
     absolutePath="welcome.png" skipAction="Delete" isDefault="true" enabled="true"/>

    To skip deleting all files on the destination, you can use the following rule.

    <rule name="DoNotDeleteFilesOnDestination" type="Microsoft.Web.Deployment.DeploymentSkipRuleHandler" objectName="filePath" skipAction="Delete" isDefault="true" enabled="true"/>

    Note: When specifying skip rules over the agent, you will need to define the rule in both msdeploy.exe.configsettings on the source and msdepsvc.exe.configsettings on the destination for it to work.


    How to write skip and replace rules for MSDeploy

    What has changed about skip-replace rules in RC?



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue.
    If you have any compliments or complaints to MSDN Support, feel free to contact
  • Re: Skip rules in .configsettings not working

    Aug 17, 2018 09:22 AM|mrmiles|LINK


    This didn’t work for me. I set up an msdepsvc.exe.configsettings as instructed but still got the same error message.

    It seems like the error is generated before it has connected to the remote service. Using -trace argument it is in the ReadConfig method. I also tried just using one of the examples in the settings file directly, and that gave the same error. It looks to me like a bug in webdeploy.

    Have you managed to set up a working version following the instructions? If so could you share the files, locations and dll versions so I can look for discrepancies. Currently i am following the instructions to the letter without success.


  • Re: Skip rules in .configsettings not working

    Aug 20, 2020 09:55 AM|GHausammann|LINK

    I encounter the same Problem with msdeploy.exe.

    Even the skip-rules from the msdeploy.exe.configsettings.examples give the error Object reference not set to an instance of an object.

    From analyzing the DLL it really seems it is a BUG in  Microsoft.Web.Deployment.DeploymentRuleCollection.ReadConfig(), somewhere in CreateAndAddRule() or rule.Initialize().

    Version of msdeploy.exe: 7.1.3802.2153

    I would be interested in a fix - thanks!

‹ Previous Thread|Next Thread ›