简体   繁体   English

如何在 Visual Studio 2022 上的单个解决方案中的项目之间共享库文件/包含文件夹?

[英]How to share Library files/ include folders between projects in a single solution on Visual Studio 2022?

I have a VS solution with two separate projects, but I would like to share the external libraries between them.我有一个包含两个独立项目的 VS 解决方案,但我想在它们之间共享外部库。 How would I go about this?我怎么会go这个呢? Let's say I have two projects in one Solution on Visual Studio Code:假设我在 Visual Studio Code 的一个解决方案中有两个项目:

Solution Project A Project B解决方案 项目 A 项目 B

I have already included the external libraries on Project A, but I want those libraries to be linked to all my projects within the solution, so I don't have to include them again every time I make a new project.我已经在项目 A 中包含了外部库,但我希望这些库链接到解决方案中的所有项目,这样我就不必在每次创建新项目时都再次包含它们。

I tried including all the libraries on one project but the other project couldn't access the library like I was expecting.我尝试在一个项目中包含所有库,但另一个项目无法像我预期的那样访问该库。 So I had to manually include the libraries for both, bot I want to avoid this to save myself some time.所以我不得不手动包含两者的库,我想避免这种情况以节省一些时间。

In order for the program to work, it is necessary to manually add the library.为了使程序运行,需要手动添加库。 But in order to reduce repetitive work, you could create a project template after adding the library, and use this template directly when creating a new project without adding the library again.但是为了减少重复性工作,可以在添加库后创建工程模板,新建工程时直接使用该模板,无需再次添加库。

About how to create a project template you could refer to this document .关于如何创建项目模板可以参考这篇文档

After the project template is created, you could directly search for it.项目模板创建好后,直接搜索即可。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Visual Studio中的项目之间共享C ++源代码文件? - How do I share C++ source code files between projects in Visual Studio? 如何在同一解决方案中的项目之间共享变量? - How to share variable between projects in the same solution? 在Visual Studio项目中创建包含文件夹和库文件夹 - Creating Include Folder and Lib folders in Visual Studio Projects Visual C++:#include 来自同一解决方案中其他项目的文件 - visual c++: #include files from other projects in the same solution 在Visual Studio解决方案中设置所有项目的运行时库 - Set Runtime Library of all projects in Visual Studio solution 在Visual Studio中为单个解决方案编译和使用多个项目 - Compiling and using multiple projects for a single solution in Visual Studio Visual Studio项目包含多个文件夹 - Visual Studio projects with multiple folders Visual Studio:解决方案中的某些项目不会生成.exe文件 - Visual Studio: some projects in solution don't generate .exe files 同一解决方案中不同项目之间的引用(Visual Studio 2012) - Reference between different projects in the same solution (Visual Studio 2012) 如何配置Qmake使用目录结构为项目中的源文件生成Visual Studio解决方案? - How to config qmake generating Visual Studio solution using directory-structure for source files in projects?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM