I got a VS project with a post-build event with a command-line command that copies a file (.dll) to the bin target dir (debug or release). When I do a "Clean" on the project every thing is cleaned, but this file remains. Is there a way to ad post-clean events so I can delete this file also?
Visual-studio – Need a “post clean event” in Visual Studio
visual studiovisual studio 2010
Related Topic
- Visual-studio – Difference between Build Solution, Rebuild Solution, and Clean Solution in Visual Studio
- How to get Visual Studio ‘Publish’ functionality to include files from post build event
- Visual-studio – How to auto format code in Visual Studio
- C# – Writing to output window of Visual Studio
- C# – Copy file(s) from one project to another using post build event…VS2010
- Visual-studio – Can you force Visual Studio to always run as an Administrator in Windows 8
- Asp.net-mvc – Visual Studio debugging/loading very slow
Best Answer
You can edit the project file directly and add the target to the end of the file.
BeforeClean
andAfterClean
are targets as explained here:https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-extend-the-visual-studio-build-process?view=vs-2019
You should be able to put a Delete task in the target.
EDIT Just tested this (right-click project -> unload -> right click -> edit) and the following target is what you need:
This works when you clean the project but not the solution - it works but not 100%.