1

I'm currently working on a build process, and am running into a slight problem. I have the output directory set up for each project that I want as it's own, but now I would like to delete specific files from the main output directory (This is produced by one project that is set to be output to the build output directory)...

The directory looks like this:

Build Out Folder:

  -Folder foo1

  -Folder foo2

  -Folder foo3

  -Folder foo4

  -foo.pdb

  -foo.dll

Here, I need to delete both the .pdb file, and the .dll file.

I've tried putting this in my csproj file:

<Target Name ="AfterBuild">
  <Delete Files="$(TeamBuildOutDir)\$(SolutionName)\**.dll"/>
  <Delete Files="$(TeamBuildOutDir)\$(SolutionName)\**.pdb"/>
</Target>

Yet, haven't gotten the results wanted/predicted... I know exactly which file I need to delete (name and everything), just not how to delete them... This is not a web application, so it doesn't have to work for that criteria.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
  • Are you using TFS build (XAML or TfsBuild.proj) or are you building in your Visual Studio? Instead of directly setting the search criterias to Files you could create a ItemGroup with them and write the content to Log `` to see if you really found the files. – MikeR Jul 24 '13 at 15:26
  • I'm using TFS Build. So, I was placing that xml code into the specific .csproj file I want to build. I found out that the person I'm making the build for actually doesn't mind that the extra files are there, but in the future I need to take them out... I'm thinking about doing a post build event, instead of directly coding it into the .csproj file (it's a lot easier and less xml coding, which I'm brand new to). Once I get the build going as is, with the extra files, and I get more time to focus on it again, I will try to work out the kinks. – Zach Blizzard Jul 24 '13 at 17:24
  • Make item group inside Target should work. See https://stackoverflow.com/a/1482551/430334 – wrongite Sep 25 '17 at 08:20

0 Answers0