MS Web部署跳过删除规则不跳过

Ben*_*ley 5 asp.net msbuild webdeploy

我已将以下跳过规则添加到我的项目中,但是当我使用Web Deploy发布内容时,/ config文件夹中的文件将被清除.

我正在使用这里发现的过程,我发誓它以前工作过.

我已将以下内容添加到项目文件中:

<PropertyGroup>
    <OnBeforePackageUsingManifest>AddCustomSkipRules</OnBeforePackageUsingManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
    <ItemGroup>
      <MsDeploySkipRules Include="SkipConfigFolder">
        <SkipAction>Delete</SkipAction>
        <ObjectName>dirPath</ObjectName>
        <AbsolutePath>.*\\config\\$</AbsolutePath>
        <XPath></XPath>
      </MsDeploySkipRules>
      <MsDeploySkipRules Include="SkipConfigSubFolders">
        <SkipAction>Delete</SkipAction>
        <ObjectName>dirPath</ObjectName>
        <AbsolutePath>.*\\config\\.*$</AbsolutePath>
        <XPath></XPath>
      </MsDeploySkipRules>  
    </ItemGroup>
</Target>
Run Code Online (Sandbox Code Playgroud)

当我发布(通过命令行使用包生成的cmd文件)时,输出以下内容:

-------------------------------------------------------
 Start executing msdeploy.exe
-------------------------------------------------------
 "C:\Program Files\IIS\Microsoft Web Deploy V2\\msdeploy.exe" 
   -source:package='<MyPackageFile>' 
   -dest:auto,includeAcls='False' 
   -verb:sync 
   -disableLink:AppPoolExtension 
   -disableLink:ContentExtension 
   -disableLink:CertificateExtension 
   -skip:skipaction='Delete',objectname='dirPath',absolutepath='.*\\config\\$' 
   -skip:skipaction='Delete',objectname='dirPath',absolutepath='.*\\config\\.*$' 
   -setParamFile:"<MySetParameters.xml>"
Info: Deleting filePath (Default Web Site/uPPK_32\config\New Text Document.txt).
Run Code Online (Sandbox Code Playgroud)

看起来正在添加跳过规则,但是通知新文本Document.txt正在被删除.我怎么能阻止这个?我错过了什么吗?

Pau*_*ith 3

我认为你的第二个跳过行需要使用 filePath 而不是 DirPath,因为你在那里选择文件。