What's the 'obj' directory for in .NET?


C# Problem Overview

What exactly is the purpose of the 'obj' directory in .NET?

C# Solutions

Solution 1 - C#

The "obj" folder is used to store temporary object files and other files used in order to create the final binary during the compilation process.

The "bin" folder is the output folder for complete binaries (assemblies).

Solution 2 - C#

In addition to splattne's answer, I believe the reason for having it (and not cleaning it up after the build) is to support incremental compilation. If you've already compiled 100 classes and change one of them, it's much more efficient to just recompile the code for the one changed class and reassemble the exe/dll from a mixture of the new and old code.

Of course, incremental compilation is a lot more complex than just that - it has to keep track of everything so it can detect when it needs to recompile a class even if that class itself hasn't changed. (e.g. if a new overload becomes available in a class - some callers may need to be recompiled.)


All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrew JonesView Question on Stackoverflow
Solution 1 - C#splattneView Answer on Stackoverflow
Solution 2 - C#Jon SkeetView Answer on Stackoverflow