C# 两个文件夹:Bin 和 Obj....有谁知道为什么...?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1085637/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 07:50:56  来源:igfitidea点击:

Two folders : Bin and Obj....Does anyone know why...?

c#visual-studiocompilation

提问by MAC

I have a very basic question.

我有一个非常基本的问题。

When we compile a VS 2005 C# application, it creates two folders. One is a binfolder and another one is an objfolder. Does anyone know why it creates an objfolder? I tried to find out the docs for it but I could not find it...

当我们编译 VS 2005 C# 应用程序时,它会创建两个文件夹。一个是bin文件夹,另一个是obj文件夹。有谁知道为什么它会创建一个obj文件夹?我试图找出它的文档,但我找不到它......

采纳答案by Spence

Devenv will compile whatever projects you have configured for debugging using the appropriate compilers.

Devenv 将使用适当的编译器编译您为调试配置的任何项目。

The compilers create obj directories as a temporary files.

编译器创建 obj 目录作为临时文件。

bin will contain a folder for each of your solution configuration (debug is the default) which contains the build outputs for your project.

bin 将包含每个解决方案配置(默认为 debug)的文件夹,其中包含项目的构建输出。

回答by peterchen

The bin\folder holds the results of the build: the binaries to distribute or archive, the XML documentation file, necessary dependencies and debug symbols.

bin\文件夹包含构建结果:要分发或存档的二进制文件、XML 文档文件、必要的依赖项和调试符号。

The obj\folder contains temporary files created during compilation. They are preserved so for an incremental build, the compiler can skip individual source files if they haven't changed and use the temporary files instead. That's faster :)

obj\文件夹包含编译期间创建的临时文件。它们被保留以便增量构建,编译器可以跳过未更改的单个源文件并使用临时文件代替。那更快:)