I have seen many requests over the years asking for help in doing post build cleanup for TFS Build.
There are many approaches for achieving this. Each has it’s own pros and cons. I would lean towards simplicity of approach and maintenance.
Assuming that you have to delete all dll’s that start with test. Modify your TFSBuild.proj file and add the following lines at the very end (just before closing </Project>):