views:

1644

answers:

4

If you use Visual Studio 2008 and have many project files within solutions how do you keep them in sync? In other words, if you change a property in one project, how do you ensure that this property is automatically changed in other projects?

A: 

I have to say, I've not heard of "nested solutions", and I'd need a pretty compelling reason to do anything of this sort. Especially considering your question really centers on "how do I maintain duplication?" since you say the solutions will share properties. It's a cardinal rule in programming "do not duplicate thyself".

sliderhouserules
slider, thank you for your comment. You'll be happy to know that I didn't create the mess I'm describing, just trying to gauge the degree of the mess and get some help to fix it. Do you have some ideas that could help me? Thanks!
fooMonster
Now that you've changed your question, it appears this is pretty specific to C++ projects, as I've never had any occasion to propagate properties between any C# or VB.NET projects I've worked on. I haven't done anything with C++ since school years ago.
sliderhouserules
+4  A: 

Given that enough contributors are mystified about the notion of nested solutions, I'll just work from the assumption you meant "solution with multiple projects". You give them common settings by using a project property sheet. Start with View + Other Windows + Property Manager. Open one of the nodes, right-click a configuration and choose Add New. Choose a location that makes sense for the solution, the solution directory for example. Configure the settings the way you want them.

Repeat this procedure for all other projects in your solution, now using Add Existing. Every project will inherit the settings you configured in the sheet, unless it overrides them explicitly. You may have to go back to the project properties and change an override back to "inherit".

IDE support for project property sheets is a bit flaky, be sure to save them explicitly when you make a change.

Hans Passant
Sorry to mystify... I've clarified the question.
fooMonster
Okay, my answer is then right on the money.
Hans Passant
A: 

You could put the required options into a compiler response file, and use the same response file in each of your .vcproj files.

See here: http://msdn.microsoft.com/en-us/library/3te4xt0y(VS.71).aspx

Basically, you create a text file like SharedOptions.rsp, and on each line of the file specify a different command-line compiler option. Like /I.\include or /DDEFINE or whatever.

Then in the c++ command-line property page of each project, you add this in the additional options box: @"SharedOptions.rsp".

Then when you edit the options in the text file, they will be picked up by all projects. It is possible that the property manager solution provided by nobugz is just a gui for this - I don't know, I am more of a command-line kinda guy.

I guess you've already done something about this in the last 2 months, but this answer is more for the googlers...

A: 

I ended up using global variables available within Visual Studio. These were variables like $ProjectName and the like. There are many available already within VS, they can be user-defined as well.

fooMonster