Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure a global output bin/obj folder for every project in a Visual Studio 2012 solution

I know that it is possible to configure the output folder per project. What I need is a way to globaly set the output folders for every project in a solution so that when new projects are added they will automatically output to the specified folder.

The best output folder structure should be something like that:

SolutionFolder
    |-Project1
    |-Project2
    |-Project3
    |
    |-Release
    |    |-bin
    |    |  |-Project1
    |    |  |-Project2
    |    |  |-Project3
    |    |-obj
    |    |  |-Project1
    |    |  |-Project2
    |    |  |-Project3
    |-Debug
    |   |-> "same structure for the debug folder"
    |-mysolution.sln 

Is this possible and if yes where to look for more info? Thank you.

like image 320
Mihail Shishkov Avatar asked Sep 17 '13 13:09

Mihail Shishkov


People also ask

How do I change the output directory in Visual Studio?

Right-click on the project node in Solution Explorer and select Properties. Expand the Build section, and select the Output subsection. Find the Base output path for C#, and type in the path to generate output to (absolute or relative to the root project directory), or choose Browse to browse to that folder instead.

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.

Can I delete obj folder in Visual Studio project?

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.

How do I create a release folder in Visual Studio?

The simplest way of doing it is by adding the desired folder to your project and the exe file on the folder. Change the properties of the exe file to "Content" and "Copy always". By doing that, everytime you rebuild your solution, the output will have the folder and exe file.


2 Answers

For non C++ projects/solutions you can use Visual Studio Templates. I don't know how to do it, but im almost sure that you can do it with VS Templates.

More information: Visual Studio Templates at MSDN

For C++ there is a tool, called "Property Manager". You can show this tool by clicking View->Other windows->Property Manager.

Property Manager allows you to create "Property sheets", and you can set up almost everything in there. For more information just google it.

like image 78
Kamil Avatar answered Oct 04 '22 09:10

Kamil


If you need this to be automatically, I think you need to have a VS extension which does this automatically... (I don't know if this exists)

Otherwise you can write a simple application which reads a .sln file (special format, but simple to parse) and updates all referenced .csproj files (XML files) with the correct output path.

like image 36
Rico Suter Avatar answered Oct 04 '22 09:10

Rico Suter