Quickly delete the bin/obj folder of each project in VS solution, vsobj

Source: Internet
Author: User

Quickly delete the bin/obj folder of each project in VS solution, vsobj

Let's talk about the bin and obj folders in VS solution. The following information comes from Baidu.

The bin directory is used to save the project-generated assembly. It has two versions: Debug and Release. The corresponding folders are bin/Debug and bin/Release. This folder is the default output path, you can choose Project Properties> Configuration Properties> output path to modify the settings.

The obj directory is used to save the compilation results of each module. NET. DLL or. EXE is saved to the bin directory. Because incremental compilation is used by default during each compilation, that is, only the changed modules are re-compiled. obj stores the compilation results of each module to speed up compilation. Whether incremental compilation is used or not. You can set it through Project Properties> Configuration Properties> advanced> incremental compilation.

 

OK. Then we will return to the most central idea. Why should we delete them? There are three reasons:

1. Reduce space usage, which is conducive to backup.

2. Upload the source code to an open-source website (such as codeproject/sourceforge.

3. Small copy capacity after packaging extended by viewpoint 1 quickly reduces energy consumption and saves life and so on...

 

The next step is to reach the final goal. How to delete them? There are also three methods:

1. manually delete a project (website/Program/class library. (The most stupid)

2. Use the Windows Search function to search for the bin and obj in the solution folder and delete the files. (A little thought)

3. Write a bat file for batch processing. You only need to double-click the file and ask your computer to help you. (Eye-catching)

 

The methods mentioned in this article cannot be either 1 or 2. As for how to write batch processing, see the following:

rd JT.Common\bin /s/q
rd JT.Common\obj /s/q

 

rd JT.Control\bin /s/q
rd JT.Control\obj /s/q

 

Inevitably, I want to introduce the rd command, from M $:

C: \> rd /?
Delete a directory.

RMDIR [/S] [/Q] [drive:] path
RD [/S] [/Q] [drive:] path

In addition to the directory,/S also deletes all subdirectories and
File. Used to delete a directory tree.

/Q quiet mode. confirmation is not required when/S is used to delete the directory tree.

 

Back to the above batch processing, careful people will certainly find a problem. If there are N projects in my solution, wouldn't I write N * 2 rd commands? I have N solutions. I don't need to write N * 2 rd commands. oh my god !!!
Is there a general batch processing file that I can use once I use it without having to write additional commands? The answer is yes. Otherwise, this blog will not be available. That's right, it is:

for /f "tokens=*" %%a in ('dir obj /b /ad /s ^|sort') do rd "%%a" /s/q
for /f "tokens=*" %%a in ('dir bin /b /ad /s ^|sort') do rd "%%a" /s/q

 

The last step is how to use it. It is very simple to write the above two commands into a file named "CleanSolution. bat "in the text file, and then threw it into the solution root directory, that is, with" xxx. sln is in the same status.
Double-click it to make it clean and refreshing.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.