Solved

Visual Studio - obj folder file

Posted on 2013-05-22
8
754 Views
Last Modified: 2013-05-30
Is there a way to tell Visual Studio to delete the intermediate obj files after a successful build?
0
Comment
Question by:HLRosenberger
  • 3
  • 3
  • 2
8 Comments
 
LVL 33

Expert Comment

by:sarabande
ID: 39190033
you probably could do it by defining an appropriate postbuild event step.

but why would you do that? deleting the obj modules would make the executable out-of-date cause the input files for the build were no more available. so every time later you have to make a full build and when you start the program from visual studio you always was asked whether to make a new build.

Sara
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39190756
I thought the obj files are intermediate files the get used during the build, and the final build files are created in bin?
0
 
LVL 33

Expert Comment

by:sarabande
ID: 39191007
yes. you are right. you don't need the obj files for execution.

but the build process would make an incremental build (beside you make a rebuild or clean before build). and when invoking from visual studio the obj files were checked whether they have a timestamp older than the executable. if you delete all those files you would get a warning that your program is not up-to-date because of this.

why do you want to delete the files?

Sara
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 40
ID: 39197920
I would not do it.

The obj folder is used internally by Visual Studio during the build process. If you delete it, you will eventually end up with slower builds because some of the files in there are being reused build after build. If you delete them, the compile will need to recreate them or copy them again each time you compile.

For intance, if you use a COM dll in your application, the interop dll needed for a VB.NET application in order to connect to COM will have to be recreated everytime, and this be time consuming if the COM dll is a big one.

The only thing you can gain from that is to save some space on the hard disk.
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39208151
Maybe I did not ask the question correctly.  I do not want to delete the folder.  I do not want to delete any  intermediate file.   I have a couple DLL project.   After building, I always end up with 2 identical copies of the DLL - one in bin and one in obj.    Then we back up our source code project, we are backing up the obj folder because it's a subfolder.  I just did not want to backup the DLL in the obj folder.  We end up with copies
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39208184
Most backup software have a way to exclude directories and/or specific files. You could use that feature on the software you use.

Personnally, I do not backup .exe, .dll and .pdb files from my projects, since these are recreated upon compilation. As long as I have the source code, I am OK.
0
 
LVL 33

Assisted Solution

by:sarabande
sarabande earned 250 total points
ID: 39209045
the copy of the dll was done by a post-build event configured in your project settings.

rather then doing a backup after build i would recommend to putting all sources to source control. you could use visual sourcesafe or - better - subversion which is freeware. th ebackup then can be an additional means, which actually shoulkdn't much care for duplicates but should make an image of the current development such that it could be recreated within short time when a ahrdware or severe software error has damaged the current environment.

generally, no temporary files and user-profile files should be added to source control. that includes all but the source files as recommended by James.

if you have all sources under source control, you have an additional restore chance. simply get all youngest sources back from source control and make a rebuild. that will in most cases be first choice over doing a restore from backup.

Sara
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 39209071
Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question