In Visual Studio, what does the “Clean” command do?

前端 未结 5 710
小鲜肉
小鲜肉 2020-12-13 08:11

You know, the one that outputs this=>

------ Clean started: Project: Foo.Bar, Configuration: Debug Any CPU ------
========== Clean: 1 succeeded,

5条回答
  •  星月不相逢
    2020-12-13 08:49

    Why not look for yourself? Open up Microsoft.Common.Targets (found under %windir%\Microsoft.NET) and you'll see a section like so:

    
    
        
            BeforeClean;
            CleanReferencedProjects;
            UnmanagedUnregistration;
            CoreClean;
            CleanPublishFolder;
            AfterClean
        
    
    
    

    Keep reading to see exactly what each of those sub-targets does. (Some, of course, are just stubs for the user to override).

    Personally, I like to see what shenanigans my fancy-pants IDE is up to behind my back. To this end, I'd recommend increasing the amount of info written to the Output window. Tools -> Options -> Projects & Solutions -> Build & Run -> MSBuild verbosity -> change from "Minimal" to "Normal" or "Detailed."

    Try your Clean operation again and watch the output now! Correlating what you see to the *.targets files is a good way to start learning MSBuild.

提交回复
热议问题