Tuesday, June 9, 2009

Bin folder & Obj folder

In Visual Studio projects you will find two different folders with almost the same files inside. Earlier, I was confused with these two folders. But now I have found the difference between the bin folder and obj folder.

Bin

Bin file contains compiled assemblies (*.dll files) of the application which contains MSIL code and some Meta data. Bin is where the final compiled code is stored. You should use this code to deploy/run your application.

Assemblies in the Bin folder do not need to be installed in the Global Assembly Cache (GAC). The presence of a *.dll file in the Bin folder is sufficient for ASP.NET to recognize it. If you change the *.dll and write a new version of it to the Bin folder, ASP.NET detects the update and uses the new version of the .dll for new page requests from then on.

Obj

Intermediate files are stored in the obj folder. When you build your application once it keeps the compiled version of that code and if you rebuild it uses that existing compiled version to link ,which improves efficiency.

This consist of *.dll, *.pdb and *.csproj.FileListAbsolute files.

*.csproj.FileListAbsolute file is a text file which contains a list of related compiled versions of the project.
*.pdb (Program Debug Database) file holds debugging information. (Generate Debug Info option is specified by default. That’s why the linker generates this file.)

When you clean the solution, all the temporary files under this folder will get deleted.
(build => cleansolution)

Basically, you don’t have to worry about what is inside this folder because bin folder contains the final version, so that you may use it, unless you are really curious about what this is all about (like me).
You have release and debug sub folders under these directories to differentiate the builds.

No comments:

Post a Comment