Question

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?

Was it helpful?

Solution 4

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.

OTHER TIPS

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.

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".

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...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top