Search code examples
visual-studioprojects-and-solutions

Visual Studio Solutions / Multiple project : How to effectively propagate project properties amongst several C++ projects


I am working with a Visual Studio 2005 C++ solution that includes multiple projects (about 30). Based upon my experience, it often becomes annoying to maintain all the properties of the projects (i.e include path, lib path, linked libs, code generation options, ...), as you often have to click each and every project in order to modify them. The situation becomes even worse when you have multiple configurations (Debug, Release, Release 64 bits, ...).

Real life examples:

  • Assume you want to use a new library, and you need to add the include path to this library to all projects. How will you avoid to have to edit the properties of each an every project?
  • Assume you want to test drive a new version of library (say version 2.1beta) so that you need to quickly change the include paths / library path / linked library for a set of projects?

Notes:

  • I am aware that it is possible to select multiple projects at a time, then make a right click and select "properties". However this method only works for properties that were already exactly identical for the different projects : you can not use it in order to add an include path to a set of project that were using different include path.
  • I also know that it is possible to modify globally the environment options (Tools/Options/Project And solutions/Directories), however it is not that satisfying since it can not be integrated into a SCM
  • I also know that one can add "Configurations" to a solutions. It does not helps since it makes another set of project properties to maintain
  • I know that codegear C++ Builder 2009 offers a viable answer to this need through so called "Option sets" which can be inherited by several projects (I use both Visual Studio and C++ Builder, and I still thinks C++ Builder rocks on certain aspects as compared to Visual Studio)
  • I expect that someone will suggest an "autconf" such as CMake, however is it possible to import vcproj files into such a tool?

Solution

  • I think you need to investigate properties files, i.e. *.vsprops (older) or *.props (latest)

    You do need to add the properties file manually to each project, but once that's done, you have multiple projects, but one .[vs]props file. If you change the properties, all projects inherit the new settings.