Inheriting C++ project properties in VS 2010 - visual-studio-2010

I have a C++ project in VS2010. I would like another C++ project to inherit its properties (e.g. include directories, external libraries, etc.). It seems the best way to do this is to use Property Sheets, but I can't figure out how to do it.
When I try adding an existing property sheet to my new project, I expect to be able to find a property sheet containing the old project's properties in the old project's directory. No such file exists.
What should I be doing?

In order to create inheritable properties you must create a new property sheet, save it in a local location and have any projects you want to have those properties use (inherit) it by "Add Existing" sheet.
The order of the listing of property sheets matters. If the property is listed as "Use default or inherit from parent" it will get the value from the property sheet directly below it or if there is none below it, it will use the default.
The sheets listed in the property sheet manager are just links. If the file is linked to multiple Configurations and you change it in one, ALL linked configurations will accept the changes. Therefore if you want to make different changes for each Config. for the same property you must make separate sheets.

Related

IDE: Apply property sheet to actual project settings

is anybody aware of a way to apply (as in write or transfer) the settings of a Visual studio property sheet to the actual properties of the project (so they appear explicitly in .vcxproj file)?
I would like to load in a property sheet, transfer the settings to the "real" project's properties (not inherit the settings from the sheet!) so I can remove the property sheet afterward again.
Does the VS IDE allow this?
I am looking for a clickable solution, not a manual transfer.
Thanks in advance
There is no built-in way to do this though you could program an extension or external executable (which is easy to invoke as External Tool in VS) to do this, using e.g the Project class. But it is not that trivial: what do to when conflicting properties are found? Replace them? Combine them? Moreover it sort of defeats the entire purpose of propertysheets which is having a reusable set of options for building.

How to make project inherit it's settings from another project in VS2013?

I want to create a Native C++ project which inherits it's settings from another Native C++ project within the same solution, so if I were to change the settings from the base project, it will be reflected in the derived project.
Is this possible? I use the word inherit because I see that in the project settings, though I'm not sure where it's inheriting from.
Project settings sharing is done via Property Sheets.
Go to View -> Property Manager, right-click on one of your projects and select "Add New Project Property Sheet...". Choose some common place for it, that is easily accessible by all other projects (somewhere near solution file will do).
Double-click on that new property sheet and set whatever options you want your projects to share. Now you can add this property sheet to any other project via "Add Existing Property Sheet...".
It is inheriting from the solution. If you have both projects in the same solution then you can specify some of settings in the solution and have the projects inherit from the solution. You can then change the a setting in the solution and it be reflected in both projects.

Is there a shortcut key to select <inherit from parent or project defaults> in VS2010 property sheets?

I am moving a multi-project solution to use .props files instead of repeatedly defining properties in the projects. At the moment I am going through all the old projects and selecting "inherit from parent or project defaults" for most of the settings.
To help prevent RSI, is there any shortcut key for setting this on a particular property? For bonus points, is there a way of listing the changed (bold) properties for a particular configuration so I can review them all in one place?
Xcode does both of these things nicely (backspace to reset a property and an option to just show settings defined at the current level). Would be great if I could find an equivalent in VS2010!

Visual Studio 2010 property sheet inheritance

I am trying to move my c++ project setting into property sheets. I use multiple third party libraries, but they are not used by all of the projects.
Is there any way to use property sheets to bring in settings specific to the third party library I need for each project (mainly include and library directories). I would like to be able to do this at a project level rather than a global level so if I get a new library I can test it without breaking my normal development projects.
As an example:
Library1: needs include directory X:\Lib1\Include and lib directory X:\Lib1\Lib
Library2: needs include directory Y:\Lib2\Include and lib directory Y:\Lib2\Lib
I tried creating two property sheets, but it appears that as VS moves through the hierarchy, it just uses the newest version of the settings that it finds (according to that hierarchy).
Is there any way to configure these so the directories properties are cumulative?
Thanks,
Eric
Click the drop-down arrow on the right of the field, select 'Edit' Check the box "Inherit from parent or project defaults' and this will automatically add the neccessary macro (eg $(AdditionalIncludeDirectories), etc)

VS 2010 Unable to remove inherited additional dependencies

Hi by mistake I added cv210d.lib, cxcore210d.lib and highgui210d.lib as inherited values under the project configuration->Linker->input->Additional Dependencies settings.
But I cannot seem to remove them from the "inherited" additional dependencies. So each time I start a new project I get an error because these liberties cannot be found.
There is an option to ignore the inherited dependencies but I cannot do this as it contains values I do need.
So I am looking for a way to remove these unwanted values from the "inherited" additional dependencies.
You can find the file "Microsoft.Cpp.Win32.user" on your system and manually edit it as you want. Normally the file will be located at "C:\Users\%USERPROFILE%\AppData\Local\Microsoft\MSBuild\v4.0" location. It is an xml file.
As was suggested I modified the property sheet in the property manager.
The reason I found it confusing though was that in the Property Manager view, there are three different ways to change the properties. Through clicking on the debug, release property sheets or the project properties . But when I opened each one I thought I was opening the same thing, as they look similar.
But the case is that, the properties from the debug and release property sheets are inherited to the project properties. And you cannot modify the inherited properties from the project properties.
Did you accidentally add it to "Linker > Input" under "Property Manager > AnyProject > AnyConfiguration > Microsoft.Cpp.Win32.user"?
Despite its strange position, this is the setting for all projects of the current user.
As soon as you put a wrong .lib file into Additional Dependencies it went to the inherited directory. You need to untick "Inherit from parent or project defaults". Then, to save inherited .lib files (such kernel.lib and etc.) you need to copy and paste all of them into the Additional Dependencies directory. So your computer cannot take the wrong .lib file and will use only Additional Dependencies which you wrote
You can open with notepad the .vcxproj file of your project and find the lib you want to remove. Then, Delete that library from the xml field.

Resources