locked
Webdeploy to skip a subfolder folder in the web sites directory? RRS feed

  • Question

  • User16290778 posted

    I cant hard code this because this needs to be reusable for all my apps.

    I have a dir under the sites virtual dir named "notocar"

    Im using this command to deploy (need to wrap skip in quotes to pass to cmd):

    mypackage.deploy.cmd /Y -allowUntrusted /U:mydom\user /P:"sdlfkjsdlkfjsldf" /M:server -enableRule:AppOffline "-skip:objectName=filePath,absolutePath=.*notocar*"

    This is not the right syntax because its still syncing that folder.

    Whats the right syntax to ignore a subfolder?

    ============= Other things I tried:

    This actually works, skipping this one file "-skip:objectname='filePath',absolutepath='Web.config'"

    These args dont working (the folder is still deleted):

    "-skip:objectname='filePath',absolutepath='notocar'"

    "-skip:objectname='filePath',absolutepath='\\notocar'"

    This seems to skip almost everything EXCEPT my folder:

    "-skip:objectname='filePath',absolutepath='.*'"

    It looks like because the notocarfolder doesnt exist in the package it deletes it every time? If I specify a folder that does exist in the package it leaves it alone. I dont want to create a logs folder just to get this to work. How do I ignore this folder? Also, enableRule:DoNotDelete is not going to work because I want it to delete everything except this one folder

    Wednesday, April 4, 2018 8:50 PM

All replies

  • User-166373564 posted

    Hi red888 ,

    I never tried to  apply the skip parameter to virtul directory . But in my opinion ,  if you skip a file/folder but it's containing directory doesn't exist on the source, the directory (and thus the file) will be deleted anyway. In addition , i find some related threads which discuss the same topic as yours :

    https://stackoverflow.com/questions/18766495/how-to-skip-virtual-directories-in-web-deploy-command-line 

    https://stackoverflow.com/questions/4289440/make-msdeploy-visual-studio-not-delete-app-data-folder-but-delete-everything-e/5659390#5659390 

    Hope it helps .

    Best Regards,,

    Angie

    Thursday, April 5, 2018 5:22 AM
  • User19976469 posted

    Not sure if it's the same thing you're trying to do but I had an ASP.NET Core web project and I was using Web Deploy to a remote server. I was trying to exclude a whole folder under wwwroot from being included in the deployment. After several failed attempts at different combinations of things the only thing that worked for me was a combination of both:

    1. Exclude the folder from the project (i.e. right-click > Exclude from project)

    AND

    2. Adding the following to my .csproj exactly as it is but changing `wwwroot\\profiles` to be the directory you want to exclude. You also have to repeat the whole snippet for each folder you want to exclude:

    <ItemGroup>
    <MsDeploySkipRules Include="CustomSkipFolder">
    <ObjectName>dirPath</ObjectName>
    <AbsolutePath>wwwroot\\profiles</AbsolutePath>
    </MsDeploySkipRules>
    </ItemGroup>

    Hope this helps

    Thursday, August 22, 2019 2:19 PM