Solved

Visual Studio - obj folder file

Posted on 2013-05-22
8
739 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 32

Expert Comment

by:sarabande
Comment Utility
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
Comment Utility
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 32

Expert Comment

by:sarabande
Comment Utility
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
 
LVL 40

Expert Comment

by:Jacques Bourgeois (James Burger)
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:HLRosenberger
Comment Utility
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
Comment Utility
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 32

Assisted Solution

by:sarabande
sarabande earned 250 total points
Comment Utility
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
Comment Utility
Thanks
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now