Separating C++ project properties between VS 2010 and VS 2013

Since Visual Studio 2010, common C++ project properties (e.g. external VC++ Directories like Include Directories and Library Directories) are defined in property sheet files and managed with the Visual Studio Property Manager. See Sharing project properties in Visual C++ by Sebastian Krysmanski for a good description of this system.

If you use both VS 2010 and VS 2013 on the same machine, you might have a problem due to the common %LocalAppData%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props file shared by all VS versions. I.e. setting Include Directories in VS 2013 Property Manager changes it for VS 2010 as well. If you want different directories for different VS versions then you have a problem.

A solution utilizes conditional property values that can be added to a specific property or a group. (You need to manually edit the %LocalAppData%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props file in a text editor as VS Property Manager doesn’t let you add conditions.) One environment variable that is not defined for VS 2010 and defined for VS 2013 is WindowsSDK_LibraryPath_x86 (source: Microsoft.Cpp.Win32.user property sheet file shared by both VS2010 and VS2012?). The result may look like this:

<PropertyGroup Condition="$(WindowsSDK_LibraryPath_x86) == ''">
<PropertyGroup Condition="$(WindowsSDK_LibraryPath_x86) != ''">

Now you have separate external Include Directories for VS 2010 C++ projects and VS 2013 C++ projects.


Organize Visual Studio tabs with Tabs Studio add-in

This entry was posted in Visual Studio tips and tagged , , . Bookmark the permalink.

1 Response to Separating C++ project properties between VS 2010 and VS 2013

  1. Alexander Symonenko says:

    A lot of thanks!!! I had a lot a time for resolve this. But more correct way to use VisualStudioVersion variable. E.g.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s