0

How can I delete files from the output folder in TFS?

Directly after the "Build solution" task I added a "Delete Files" task with

Source Folder
$(Build.BinariesDirectory)

and

Contents
**/*beer*test*.dll
**/*beer*test*.pdb
**/*beer*secret*.dll
**/*beer*secret*.pdb

assuming that

mybeer.is.secret.dll

would be removed from the output folder and thus also not be published in the final "Publish Artifact" step.

But it seems like nothing gets deleted.

Also, if possible, I would like to just delete specific from the output folder, I am not sure if Build.BinariesDirectory is a good choice for that.

The ** I use because of the folder hierarchy the build generates relative to the (presumably) BinariesDirectory, which is SolutionName\bin\Debug in my case, files need to be deleted from the Debug folder.

Andreas Reiff
  • 7,961
  • 10
  • 50
  • 104

1 Answers1

0

I suppose mainly the Source Folder was wrong. I also updated the Contents part to be more specific though (folders were also specified in the "Copy Files to: $(build.artifactstagingdirectory)" step

$(Build.Repository.LocalPath)

.

**\bin\$(BuildConfiguration)\**/*beer*test*.dll
**\bin\$(BuildConfiguration)\**/*beer*test*.pdb
**\bin\$(BuildConfiguration)\**/*beer*secret*.dll
**\bin\$(BuildConfiguration)\**/*beer*secret*.pdb

Seems to be working now.

Andreas Reiff
  • 7,961
  • 10
  • 50
  • 104