What is bin and obj folder in C#?


Whenever we write a C# code and build or run the solution it generates 2 folders −

  • bin
  • obj

These bins and obj has the compiled code

Why do we have 2 folders?

The reason is the compilation process goes through 2 steps

  • compiling
  • linking

In the compiling every individual file is compiled into individual units

These compiled files will be later linked into one unit which can be a dll or an exe

Whatever happens in the compiled phase will be added into obj folder

The final compilation that is the linked phase will go into bin folder

This obj folder is used in Conditional compilation or incremental compilation

Ex − I have a big project and it has multiple solution and multiple files

suppose if I change any one of the files and build the solution then only that file will be compiled this information will be present in the obj folder

Updated on: 05-Aug-2020

916 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements