I'm trying to write a MSBuild Task that deletes the Obj directory and PDBs from my bin folder on my production build scripts and can't seem to get it to work right.
Does anyone have an example where they do this or similar, or a link to a simple example of removing files and a directory with MSBuild?
Setting a folder to auto-deletebutton for the folder and select Settings. From the Folder Settings screen scroll down to Automated Actions>Delete or Unshare. Check the Auto-delete this folder on a selected date checkbox and choose a date you want the folder to be deleted.
When you clean a build, all intermediate and output files are deleted, leaving only the project and component files. From the project and component files, new instances of the intermediate and output files can then be built.
You can delete the files in those directories first and then the dir itself with
<Target Name="SomeTarget"> <ItemGroup> <FilesToDelete Include="Path\To\Obj\**\*"/> </ItemGroup> <Delete Files="@(FilesToDelete)" /> <RemoveDir Directories="Path\To\Obj\" /> </Target>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With