我在我的项目中添加了以下跳过规则,但是当我使用 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>
当我发布时(通过命令行使用包生成的 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).
似乎正在添加跳过规则,但请注意正在删除 New Text Document.txt。我怎样才能防止这种情况?我错过了什么吗?