In Visual Studio, what does the Clean command do?

You know, the one that outputs this =>

------ Clean start: Project: Foo.Bar, Configuration: Debugging Any CPU ------
========== Clear: 1 succeeded, 0 failed, 0 skipped ==========

What kind of cleaning is this?

+53
build-process visual-studio
Oct 21 '09 at 19:59
source share
5 answers

Output directories - it deletes previously generated code.

It does not delete the bin / obj directories themselves (or the Debug / Release subdirectories below them), as well as the actual .exe, .dll, etc. files. Unfortunately, this makes it less useful for my normal use of cleaning output directories: when I want to pin the source code. Since the Clean action does not do this, I usually just delete the bin and obj directories directly.

+57
Oct 21 '09 at 20:00
source share
โ€” -

Why not look for yourself? Open Microsoft.Common.Targets (found in% windir% \ Microsoft.NET) and you will see a section like this:

<!-- ============================================================ Clean Delete all intermediate and final build outputs. ============================================================ --> <PropertyGroup> <CleanDependsOn> BeforeClean; CleanReferencedProjects; UnmanagedUnregistration; CoreClean; CleanPublishFolder; AfterClean </CleanDependsOn> </PropertyGroup> <Target Name="Clean" Condition=" '$(_InvalidConfigurationWarning)' != 'true' " DependsOnTargets="$(CleanDependsOn)" /> 

Keep reading to see exactly what each of these subgoals does. (Some, of course, are just stubs for the user to override).

Personally, I like to see that, from behind me, my masquerade parachutist is sitting behind me. To this end, I would recommend increasing the amount of information recorded in the Output window. Tools โ†’ Options โ†’ Projects and Solutions โ†’ Build and Run โ†’ MSBuild Verbosity โ†’ Change from โ€œMinimumโ€ to โ€œNormalโ€ or โ€œDetailedโ€.

Repeat the cleaning operation and see the result! Correlation of what you see in * .targets files is a good way to start learning about MSBuild.

+26
Oct 21 '09 at 20:13
source share

It goes through your output directories and deletes any related files in them.

I think you can also configure this by going to Project properties in

Configuration Properties -> General, in the "Extensions to Uninstall on Cleaning" section

+14
Oct 21 '09 at 20:00
source share

deletes all files related to assembly, output directories

+3
Oct 21 '09 at 20:01
source share

People use โ€œcleanโ€ to force recovery from the source to complete. Your compiler does not rebuild every file every time if it has not changed.

+1
Oct. 21 '09 at 20:06
source share



All Articles