You have a .NET solution with many projects.
You need to deliver the solution to a client very frequently.
You need to clean up all intermediate folders or files to reduce the package size and make the result look tidy.
You want to automate this process to reduce cleaning up time.
- In Visual Studio, right click a project and select Properties.
- Click on Build Events.
- Enter the following commands to the Post-build event command line text box:
rd /s /q $(ProjectDir)obj cd $(TargetDir) del *.config del *.pdb del *.xml
rd /s /q $(ProjectDir)obj: Remove the obj folder in the project directory.
cd $(TargetDir): Move to the output directory.
del *.config: Delete all the config files in the output directory.
del *.pdb: Delete all the pdb files in the output directory.
del *.xml: Delete all the xml files in the output directory.
You can modify these commands or add new commands for your specific purpose.
- Save the project.
- Repeat the process for all the projects in the solution.