简体   繁体   中英

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'.

将根文件夹添加到您的Regex表达式中,那么它不应仅跳过根文件夹中的views文件夹中的web.config:

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

To complement about chief7 mentions about:

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

this command works if you are using -enableRule:DoNotDelete, because the web.config will be skipped from the source but will be deleted from the target. So if you are not using the -enableRule:DoNotDelete, another approach is using the skipAction over the target web.config.

-skip:objectName=filePath,absolutePath='{WebSiteName}\\\\Web\\.config$',skipAction=Update

replace {WebSiteName} by your web site name.

eg

-skip:objectName=filePath,absolutePath='CommicsTest\\\\Web\\.config$',skipAction=Update

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM