BIN and OBJ folders)

Source: Internet
Author: User

Bin is the directory where the final code is stored.
OBJ is the directory where the intermediate code is stored.

Release and debug are different running modes.
Debug adds debugging code to facilitate debugging. After debugging, release with the release version, without debugging code, reduce the program size and speed up execution!

1. Let's talk about compilation first:
To compile a source program file, you must go through the syntax, type, and even determine the feasibility of execution.
Is a process of Scanning files multiple times, and finally there is a process of code optimization. There will be a lot of intermediate files generated. There are several Mb intermediate (temporary) files in the OBJ directory of an MFC project under vc6.
In addition, if a project has image (sound) and other resource files, you need to call other DLL class libraries (possibly.. NET component, which may be com. CS file. Connect so many things together. To use cor pascalin a DOS file, compile the. Object File and connect it together with link.exe. This is an EXE file. (Remember that Pascal or Fortran must use two compilation programs to obtain an intermediate. OBJ file)
Conclusion: compilation requires a large number of intermediate files to store temporary results to prepare for the next step. C # is more object-oriented! The OBJ directory is used to store temporary files!

Ii. debug & release
Debug debugging: You set a breakpoint in the program. Why does vs.net know to stop there? When you move the mouse over a variable, vs.net will display its current value?
The compiler adds a lot of code required for debugging to the code, which can be obtained by vs.net and returned to you.
Of course, these codes take up space and time. After debugging your program, you can run the code correctly. The code can be completely removed, and the release mode should be used at this time.

Both the debug and release modes require compilation and temporary code generation. Therefore, the OBJ directory contains the debug release directory. The compilation results of the two modes are stored in the bin directory.
After compilation, the temporary code in the middle is useless, so it generally does not matter what is in the OBJ directory!

 

 

C # differences between the bin directory and OBJ directory in the project, and the differences between the debug version and the release version

1. About the bin directory and OBJ directory

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.

2. Setting of "Copy to local"

When a reference is added,. Net records the absolute reference path to be added. these settings are saved in the "per user" file (solution. csproj. User), which can be opened in notepad. You can also view it in: Project Properties> General Properties> reference path. If the local copy setting is set to true, the DLL is automatically copied to the bin directory when the project is generated. Otherwise, the DLL is not copied. When a project is generated, the referenced absolute path is added, while the runtime assembly is found only in the current path by default. To modify the referenced path, you must use a programming method. Use a references object.

@
Some software has Enterprise Edition and Standard Edition functions, and. Net assembly has the difference between debug and release.

 

When the debug mode is selected on the Assembly properties page, the settings are as follows:

When the release mode is selected, the settings are as follows:

The differences between the two are as follows:

Project Debug Release
Conditional compilation constant Debug; trace Trace
Code optimization False True
Output path Bin/debug Bin/release
Generate debugging information True False

The program set generated in debug mode is the debugging version without optimization. There are two files in the bin/debug/directory, except for the .exe or. there is also a. dll file. PDB file, this. the PDB file records debugging information such as breakpoints in the Code. In release mode, debugging information is not included and the code is optimized. There is only one .exe or directory in/bin/release/directory. DLL file.

Note: to change the project generation mode, you must click the "configuration" drop-down box on the project properties page to change the mode.

 

This is what msdn says about debug and release:

The Visual Studio project has separate configuration for release and debugging versions of the program.
As the name suggests, the purpose of generating a debug version is for debugging, and the purpose of generating a released version is for final distribution of the version.
If you create a program in Visual Studio, Visual Studio automatically creates these configurations and sets the appropriate default options and other settings. Under the default settings:
The "debug" configuration of the program is compiled with all the debugging information, without optimization. (Optimization will complicate debugging, because the relationship between source code and generated commands is more complex .)
The program's "publish" configuration is fully optimized and does not contain any symbolic debugging information. Debugging information can be generated in a separate PDB file.

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.