Extending the Clean

Whenever you extend the build process to generate files you must make sure that those files get cleaned up when the clean process is executed. Two primary ways of performing this are:

  • Appending to the FileWrites item list

  • Injecting custom targets into the clean process

The Microsoft.Common.targets file maintains a list of files that needs to be removed when the Clean target is executed; this list is the FileWrites list. It is written to disk in the base intermediate output path (i.e., obj\Debug) as the ProjectFileName.FileListAbsolute.txt file, where ProjectFileName is the name of the project file, including the extension. You can add values to the FileWrites item list if you need files deleted that were generated by custom steps ...

Get Inside the Microsoft® Build Engine: Using MSBuild and Team Foundation Build now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.