Friday, December 14, 2007
There's a very useful (although still with annoying problem I'll discuss below) feature in Visual Studio (VS) 2005 for this. I come across this when I finally fed up with copy and pasting include and link parameters.vcproj problem and do some searching. It turn out the feature is already exist, only not yet on my radar at that time. This feature called Property Sheet, (not to be mixed up as a Windows Dialog type with the same name).
Property Sheet (.vsprops) is a "neutral" project property that you could made and be inherited/linked by several project file (.vcproj). What I mean neutral is that it is made for the sake of it's values and not to be executed directly as a build file.
Visually it would look like this :
This is not something revolutionary, of course. Many build system has already done this and a lot of them doing it in a more flexible and light manner. However, for those who stuck in using the integrated build in Visual Studio, this feature is really helpful. The visual editor for it (Property Manager View) is interesting too and can enable you to make a library that can be linked the way you add Reference in .net project although with more work.
Now, for the negative side : It still a lot of work to do it with the interface that VS provide and the xml format does not look safe to be modified by hand. But the worst of all is the saving mechanism : it feels unintegrated with the rest of the file-saving mechanism of VS. I find myself loosing changes of the .vspros file several time. When you make changes to a vsprop, be sure to click a tiny save button in Propert Manager View every time.
Build system is very crucial in maintaining C++ project agility. If you are using Visual Studio build, then exploiting .vsprops could avoid you being exploited by the project instead.