Search code examples
web-configrootmsdeployskip

msdeploy skip only web.config root


I'm deploying a website using a package provider with msdeploy and I'm trying to skip only the Web.config root file.

I've got this command but unfortunately it skips any Web.config files not just the root Web.config file that I want. I have read other posts on this forum and different websites about this same issue but it still doesn't work. I don't understand why msdeploy is so complicated to use, it is just ridiculous.

This is the command I'm using:

msdeploy -source:package='"src\Parapa.Website\obj\Test\Package\Parapa.Website.csproj.zip"'
-dest:auto,computerName='http://computer/MSDeployAgentService',username='luis',password='luis',includeAcls='False'
-verb:sync 
-disableLink:AppPoolExtension 
-disableLink:ContentExtension 
-disableLink:CertificateExtension
-setParamFile:""src\Parapa.Website\obj\Test\Package\Parapa.Website.csproj.SetParameters.xml"" -setParam:"IIS Web Application Name"="staging-cm" 
-skip:objectName=filePath,absolutePath='.*\\Web.config$' 
-enableRule:DoNotDelete

Info: Object filePath (C:\ProgramFiles\TeamCity\buildAgent\work\d29656a51131c443\src\Parapa.Website\obj\Test\Package\PackageTmp\Views\Web.config) skipped
Info: Object filePath (C:\ProgramFiles\TeamCity\buildAgent\work\d29656a51131c443\src\Parapa.Website\obj\Test\Package\PackageTmp\Web.config) skipped due to skip directive 'CommandLineSkipDirective 1'.

Solution

  • Add the root folder to your Regex expression then it should not skip the web.config in the views folder only the root:

    -skip:objectName=filePath,absolutePath='.*\\PackageTmp\\Web.config$'