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?
相关问题
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
- Visual Studio 2019 - error MSB8020: The build tool
- 'System.Threading.ThreadAbortException' in
- Visual Studio 2010 randomly says the command line
相关文章
- How to show location of errors, references to memb
- Log4Net Multiple Projects
- How to track MongoDB requests from a console appli
- Compiling error in C++ project with C and C++ code
- Visual Studio Hangs on Loading UI Library
- How to use Mercurial from Visual Studio 2010?
- VSIX: execute code on VS startup
- Copy different file to output directory for releas
I think something changes with Visual Studio 2017.
Works with tag : AfterTargets="Clean"
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%.
Hat tip to @scrat789 regarding AfterTargets.
For VS 2017, v15.6.0 Preview 2.0, I ended up with the following:
A few things:
Here's the task improved to obliterate the webpack dist directory upon Clean:
You can do wildcards using built in Delete function.
You can update the csproj file to specify a new target. You will have to this in a text editor.
Take a look at the documentation here : How to: Extend the Visual Studio Build Process.
You will have especially to change the
<Target name='AfterClean'>
I've found that Leom Burke's answer using "Delete Files" doesn't work with wildcards and doesn't tell you that anything went wrong. Here's what i've done instead -
I wrote the above to remove files in an umbraco solution so that when i do a diff with what's in source control, it doesn't confuse the snot out of me.