Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VisualStudio: How to save the obj folder somewhere else

Does anyone know how to tell VS(2008) where to save the obj folder when building the solution? We have it save the bin folder to another path in order to keep the source file folders small (ie. emailable), but can't find any way to tell it to do the same with obj...

like image 642
Joel in Gö Avatar asked Nov 04 '08 10:11

Joel in Gö


People also ask

Can I delete obj folder Visual Studio?

Delete bin and obj foldersThe bin and obj folders are usually safe to delete since they are automatically generated when the solution/project is being build by Visual Studio/MSBuild. This feature is off by default, but can easily be enabled in the settings.

What is Obj folder in Visual Studio project?

The obj folder holds object, or intermediate, files, which are compiled binary files that haven't been linked yet. They're essentially fragments that will be combined to produce the final executable. The compiler generates one object file for each source file, and those files are placed into the obj folder.

What is .NET obj folder?

The "obj" folder is used to store temporary object files and other files used in order to create the final binary during the compilation process.


4 Answers

Use the BaseIntermediateOutputPath property in the project file (.csproj, .vbproj, etc.), as explained at http://msdn.microsoft.com/en-us/library/bb629394.aspx. You'll have to manually edit the XML document using a text editor, then reload it in Visual Studio. It may still create the obj folder (that's a known bug), but will leave it empty and put the actual obj files in your specified folder.

like image 120
Sören Kuklau Avatar answered Sep 20 '22 22:09

Sören Kuklau


  1. You add this to your project file below <OutputPath> tag:

    <IntermediateOutputPath>..\Whatever\obj\</IntermediateOutputPath>
    
  2. VS will still create obj folder , so you have to delete it every time after a build. This can be done by putting the following script to the post-build part in VS :

    rd "$(ProjectDir)obj" /S /Q
    
like image 40
Dominik Antal Avatar answered Sep 21 '22 22:09

Dominik Antal


Do you use version control? If you do, there's an alternative:

You can exclude bin/ and obj/ from version control and check out your project instead of e-mailing. If you use Subversion, you could also Export your project and e-mail the exported and zipped folder.

like image 22
Alexander Kojevnikov Avatar answered Sep 20 '22 22:09

Alexander Kojevnikov


It's the Output Directory under Properties > General of the project settings.

Edit: it seems like there is a difference between the project settings for native C++ projects (which I'm using) and CLR based projects (which might be what the OP is referring to).

like image 25
fhe Avatar answered Sep 22 '22 22:09

fhe