目前,我使用
-enableRule:DoNotDeleteRule
,但这会在目标位置上留下旧文件。<exec>
<executable>$(MsDeploy)</executable>
<baseDirectory>$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\</baseDirectory>
<buildArgs>-verb:sync
-source:iisApp="$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\"
-dest:iisApp="$(website)/$(websiteFolder)"
-enableRule:DoNotDeleteRule</buildArgs>
<buildTimeoutSeconds>600</buildTimeoutSeconds>
<successExitCodes>0,1,2</successExitCodes>
</exec>
我尝试使用跳过操作,但遇到了问题。最初,我删除了DoNotDeleteRule并替换为(多个)skip。
<exec>
<executable>$(MsDeploy)</executable
<baseDirectory>$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\</baseDirectory>
<buildArgs>-verb:sync
-source:iisApp="$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\"
-dest:iisApp="$(website)/$(websiteFolder)"
-skip:objectName=dirPath,absolutePath="assets"
-skip:objectName=dirPath,absolutePath="survey"
-skip:objectName=dirPath,absolutePath="completion/custom/complete*.aspx"
-skip:objectName=dirPath,absolutePath="completion/custom/surveylist*.manifest"
-skip:objectName=dirPath,absolutePath="content/scorecardsupport"
-skip:objectName=dirPath,absolutePath="Desktop/docs"
-skip:objectName=dirPath,absolutePath="_TempImageFiles"</buildArgs>
<buildTimeoutSeconds>600</buildTimeoutSeconds>
<successExitCodes>0,1,2</successExitCodes>
</exec>
但这会导致以下结果:
所以我从iisApp改为contentPath,而不是使用dirPath、absolutePath,只用Directory,就像这样:
错误:源(iisApp)和目标(contentPath)对于给定的操作不兼容。
错误计数: 1.
<exec>
<executable>$(MsDeploy)</executable
<baseDirectory>$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\</baseDirectory>
<buildArgs>-verb:sync
-source:contentPath="$(ProjectsDirectory)$(projectName)$(ProjectsWorkingDirectory)\Website\"
-dest:contentPath="$(website)/$(websiteFolder)"
-skip:Directory="assets"
-skip:Directory="survey"
-skip:Directory="content/scorecardsupport"
-skip:Directory="Desktop/docs"
-skip:Directory="_TempImageFiles"</buildArgs>
<buildTimeoutSeconds>600</buildTimeoutSeconds>
<successExitCodes>0,1,2</successExitCodes>
</exec>
这个错误信息是:Illegal characters in path。
< buildresults>
信息: 正在添加 MSDeploy.contentPath (MSDeploy.contentPath)。
信息: 添加 contentPath (C:\WWWRoot\MySite
-skip:Directory=assets
-skip:Directory=survey
-skip:Directory=content/scorecardsupport
-skip:Directory=Desktop/docs
-skip:Directory=_TempImageFiles)。
信息: 添加 dirPath (C:\WWWRoot\MySite
-skip:Directory=assets
-skip:Directory=survey
-skip:Directory=content/scorecardsupport
-skip:Directory=Desktop/docs
-skip:Directory=_TempImageFiles)。
< /buildresults>< buildresults>
错误: 路径中包含非法字符。
错误计数: 1。
< /buildresults>
所以我需要知道如何配置此任务,使得被引用的文件夹不会在同步时删除其内容,并且完成/自定义文件夹中的*.manifest和*.aspx文件也会被跳过。