方法一:一次修改多個 Project 的 Properties
- 在 Solution Explorer 中,透過 Ctrl+滑鼠左鍵 選取欲設定的多個 Projects。
- 點選 Project > Properties,即可一次修改多個 Projects 的屬性設定。選擇 VC++ Directories 設定進行修改。
- 在 Include Directories 設定中,添加 include 目錄。
- 在 Library Directories 設定中,添加 lib 目錄。
- 在 Configuration 欄位選擇 All Configurations,可以將設定同時套用到 Release 和 Debug 模式。
- 在 Platform 欄位選擇 All Platforms,可以將設定同時套用到 Win32 和 x64 平台。
方法二:透過 Property Manager 建立共用的 Property Sheet
- 點選 View > Property Manager,會顯示 Property Manager 視窗。
- 在 Property Manager 視窗中,透過 Ctrl+滑鼠左鍵 選取欲設定的多個 Projects。
- 點選 Property Manager 的 Add New Project Property Sheet 圖示,並指定 Property Sheet 的檔名和存放的位置。
- 在 Property Manager 的 Project 清單中,任選一個剛剛選取的 Project。在其中找到新增的 Property Sheet,並雙擊開啟。
- 選擇 VC++ Directories 設定進行修改:在 Include Directories 設定中,添加 include 目錄;在 Library Directories 設定中,添加 lib 目錄。
- 設定完成之後,點擊確定。此時修改的設定,就會套用到剛剛指定的多個 Projects。
- 點選 Property Manager 的 Save 圖示,將修改的設定儲存到 Property Sheet 檔案中。
- 若有其他 Projects 要套用相同的設定,選取該 Projects 之後,透過 Add Existing Property Sheet,即可快速套用相同設定。
參考資料
- How to add additional include directory on solution level?
- How to add include/lib directory to all projects in MSVC 2015 solution?
- Share or reuse Visual Studio project settings
https://docs.microsoft.com/en-us/cpp/build/create-reusable-property-configurations?view=msvc-170
沒有留言:
發佈留言