Solved

Visual Studio - obj folder file

Posted on 2013-05-22
8
770 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 34

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 34

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 34

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

623 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