Visual Studio 2010 property sheet inheritance - visual-studio-2010

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)

Related

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.

Inheriting C++ project properties in VS 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.

merging multiple projects into one project in solution

Is it possible to create solution in which I'll have some projects of Class Library type, and another one merging project, that will be Class Library containing source of all other projects in solution ?
It's possible to share code files between projects by adding them as a link in the additional projects. I use this technique to share copies of PetaPoco, common AssemblyInfo files, etc. between my projects. You could possibly use this technique to do what you want.
To do this, add and create the code files you want to the first project as you normally would. Then, in the projects in which you want to use an existing code file:
Right-click the project in Visual Studio Solution Explorer.
Choose Add -> Existing item...
Choose the code file that already exists, but on the Add button click the down arrow and choose "Add as Link" instead.
Now anytime you make changes to the original file, it will be reflected in all the other projects in which you added that file as a link.
Hope this helps.

Change default Add File path in Visual C++ 2010

When adding a new item in a Visual C++ project, the default path for the new file is the project path. Are there any per-project or per-solution settings that allow this default path to be modified?
For example, to add new files by default to a subdirectory of the project folder, or even to somewhere outside the project folder?
I understand that filters can be used to automatically organize files visually within the Solution Explorer based on file extension, but I would like to actually place the physical file in another location without the need to browse to it.
I'm using a Visual C++ project as a container to to manage and organize (filter) editing of runtime-compiled files, and don't want developers to accidentally place new files outside of the intended folder, nor do I want the project file to exist in this code folder.
I did discover that if you create a new file in a sub directory of the project, that the Add Item dialog will default to that path when you add another file during that session, but it does not persist the default to the project or solution for future sessions.
I don't believe there's anything built-in. Some commercial add ins make the behavior better. For example, Whole Tomato's Visual Assist X package always uses the same directory as the currently open file, IIRC.
There are a couple of open source add ins that let you modify the behavior. For example, this one.

How do you dissasociate a single file in a VS2010 project which is under source control from source control iteself?

We have a project (C#) which has been added to source control (TFS 2010), however one of the project files is anauto generated one and as such we dont want it under source control.
Is there a way to remove the source control association for this single file in the project?
Please note the autogenerated file is made from a custom XML document using an internal standalone tool. Whilst I appreciate a long term solution to this issue would be to not have the file linked to the project, but to include the source XML document and have it associated with an appropriate custom tool to generate the C# file at build time. Sadly creating said custom tool is not going to happen in my immediate future hence the query about dissacociating the generated file that is in the project from the projects TFS source control.
Open up the project and select the file.
On the VS menu go to: File -> Source Control -> Exclude FILE_NAME From Source Control

Resources