0

I want to create a web deployment package which leaves certain existing directories alone when deploying, e.g. a "logs" folder. Currently the package deletes/overwrites all existing files.

I can exclude the folder by adding extra parameters when executing the foo.deploy.cmd in the package, eg.:

 .\foo.deploy.cmd /T """-skip:Directory=\\logs"""

This seem to work. But I can't figure out how to include this configuration in the package itself so it will be applied automatically.

I have a Asp.net Core website on .net framework 4.7. I use Visual studio 2019 with a pubxml publish profile.

I have tried adding MsDeploySkipRules to the pubxml but they don't seem to be passed to the package parameters. I am unsure if MsDeploySkipRules should work with "Web Deploy Package" or only with "Web Deploy"?

Edit: The problem may be related to I'm using Asp.net core. The MsDeploySkipRules seem to be applied in a regular asp.net (added in the generated deploy.cmd script) project but not if I insert the same in an asp.net core project file.

JacquesB
  • 41,662
  • 13
  • 71
  • 86

1 Answers1

0

You could try to add the below code in your .csproj file to skip the folder at the time of publishing.

    <ItemGroup>

    <Content Remove="wwwroot\test\**" />
  </ItemGroup>

also ste the delte existing file to true:

enter image description here

ASP.NET Core: Exclude or include files on publish

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26