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?
It is also possible to first remove the readonly property from the file and to execute the msbuild delete Task.
Like so:
In Visual Studio 2013, added this to the end of my .csproj file just before the
</Project>
closing tagAt first it didn't appear to work but I noticed that Visual Studio (or R#, not sure) re-re-added
DesignTimeResolveAssemblyReferencesInput.cache
to the obj folder and it also re-added the current\bin
folder (I have different builds in different subfolders under\bin
). It cleaned away everything else, including the 25 other build configs I have from imported .csproj files (yes, I know).Be careful if you Batch Rebuild more than one config as it just wipes all previous efforts on each rebuild leaving you with only the last one. Whups.