将相同 library/include 路径添加到 Visual Studio 中不同项目的智能方法

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

我知道这个问题可能看起来很菜鸟,但实际上我有相当丰富的编码经验,只是我对 Visual Studio 还很陌生(几个小时前才安装 VS_2017)我现在正在为全局选项苦苦挣扎:我找不到为不同项目指定库位置的方法。

我知道每个项目都有 2 个选项:“C/C++ » 常规 » 附加包含目录” & “链接器 » 常规» 额外的库目录”,但问题是我有 3 个库 (atm),它们在一堆不同的项目中使用(将会有更多的项目通过 git 加载,它们都会使用相同的 2-3 个库)...

因此,手动为每个项目指定相同的目录对我来说似乎效率很低,但我经常找不到 include/lib 路径的任何全局选项...我用谷歌搜索了“”工具 » 选项 » 项目和解决方案 » VC++ 目录 » 包含文件”,但此类功能在 VS 2017 中已弃用。

所以:

  1. 我想知道 Visual Studio 2017 年是否真的存在这样的功能(或一些替代品)
  2. 我想知道是否有一些像某些宏一样的横向可能可以通过几次点击将库(以前配置的路径)添加到项目中(如果已经为其中一个库指定了一些路径,最好使用 RegExp 语法进行替换)

P.S。我知道 Win OS 中的环境变量,但这对我来说是不可接受的,因为将它与仅由 VS IDE!

使用的目录一起丢弃看起来不合理

考虑参考下面的 MSDN 文章 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.

除了 Sumeet 的 post,在 Windows Explorer 中可以很容易地找到文件的位置

%localappdata%\Microsoft\MSBuild\v4.0

.