How to Recursively Delete wildcard files in TFS Build?

牧云@^-^@ 提交于 2019-12-06 08:56:00

Modify your TFSBuild.proj file and add the following lines at the very end (just before closing ):

<Target Name="AfterDropBuild">
<ItemGroup>
   <FilesToDelete Include="$(DropLocation)\$(BuildNumber)\**\temp*.*" />
</ItemGroup> 

<Delete Files="@(FilesToDelete)" TreatErrorsAsWarnings="true"/>
</Target>

I don't think the Delete task will automatically expand the wildcard. You'll need to specify an itemgroup first, then pass that into the Delete task:

<ItemGroup>
  <FilesToDelete Include="T:\DeploymentDir\**\A*"/>
</ItemGroup>

<Delete Files="@(FilesToDelete)"/>

With MSBuild 3.5 onwards you can include the ItemGroup in the same target as the Delete task.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!