visual-studiovisual-c++visual-studio-2017include-path

Smart way to add same library/include paths to different projects in Visual Studio


I know the question may seem really noobish, but actually i have pretty huge coding experience, and it's just that i'm pretty new to Visual Studio (installed VS_2017 just few hours ago) and i'm rly struggling with global options now: i can't find a way to specify location of a library(-ies) for different projects.

I know there r 2 options for every project: "C/C++ » General » Additional Include Directories" & "Linker » General » Additional Library Directories", but the thing is that i have 3 libraries (atm) and they used in a bunch of different projects (there will be even more projects loaded via git and they all will be using same 2-3 libs)...

So specifying the same directories for every project manually seems very inefficient to me, but i rly can't find any global option for include/lib paths... I googled 'bout "Tools » Options » Projects and Solutions » VC++ Directories » Include files" but such feature is deprecated in VS 2017.

SO:

  1. i wonder if such feature actually exists in Visual Studio 2017 (or some replacement)
  2. i wonder if there is some sideway like some macro maybe which can add library (previously configured paths) to a project via couple clicks (preferably with RegExp syntax for replacement if there is some path specified for one of libs already)

P.S. i know about Environmental variables in Win OS's, but it's not acceptable for me 'cuz it looks unreasonable to trash it with directories which will be used ONLY by VS IDE!


Solution

  • Consider referring the below MSDN article https://social.msdn.microsoft.com/Forums/vstudio/en-US/a494abb8-3561-4ebe-9eb0-6f644a679862/visual-studio-2010-professional-how-to-add-include-directory-for-all-projects?forum=vcgeneral

    Prior to VS2010, VC++ Directories could have been used, but as you mentioned that setting is deprecated now.

    VC++ Directories are no longer supported in VS2010 through Tools->Options page. Instead, VS2010 introduces the user settings file (Microsoft.cpp..users.props) to control global settings including Global search path. These files are located at $(USERPROFILE)\appdata\local\microsoft\msbuild\v4.0 directory. Upon migration to VS2010, the custom settings of VC++ Directories from VS2005 or VS2008 are migrated to these user files. These global settings files are imported into all the converted and newly created projects.

    Here are the steps to change the settings file through UI:

    · Open up property manager by clicking on View.Property Manager.

    · Expand the project node and then the Configuration|Platform nodes, you will see "Microsoft.cpp..users" file for each Configuration|Platform. These are the files for the global settings, similar to the old tools/Options/VC++ Directories.

    · Multi-Select "Microsoft.cpp..users", right click and bring up the property page window

    · In the property page window, click on "VC++ Directories" (for example) in the left pane, add new paths for the directories such as "Include Directories". separated by semicolons

    · Make sure to save the settings before shutting down Visual Studio.

    · Re-launch Visual Studio and the new settings will be in effect.