mans
mans

Reputation: 18228

How to define default project setting in a visual studio solution

I have a solution that has several projects all related to each other.

When I create a new project, I need to go into its setting and change default setting (for example additional include directory, additional lib directory, using Unicode and ...)

Is there a way that I can create a configuration in solution that all projects using that setting if I am not setting that property for the project (for example type of project, if it is MFC or console or library )

Upvotes: 5

Views: 9898

Answers (2)

You can create a property sheet with the common properties and add it to each project after you create it. To create a property sheet, open the Property Manager (View > Other windows > Property manager), right click a project and select Add New Project Property Sheet. The sheet will be added to the tree, you can edit it by double-clicking it.

You can then add this to other projects by right-clicking them in the Property Manager and using Add Existing Project Property Sheet.

You can also add sheets only to a particular configuration, not to the entire project. This way you can e.g. have a sheet per configuration.

A project can have any number of property sheets, and they cascade. Thanks to this, you can even fine-tune settings while still keeping them centralised. For example, in one of my applications, I have property sheets cpu.vsprops, gpu.vsprops, optimized.vsprops and debug.vsprops. My projects have several configurations: CPU - Debug, CPU - DebugOptimized, CPU - Release, GPU - Debug, GPU - DebugOptimized, GPU - Release. Each of these has the right mix of property sheets assigned.

Upvotes: 2

jessehouwing
jessehouwing

Reputation: 115037

You can create a project template for your specific settings and import that into Visual Studio:

See:

Upvotes: 4

Related Questions