“使用Visual Studio 2015,我找不到‘引用的包’选项。”
“这取决于您是否在项目中安装了freeglut包。如果您创建一个没有安装任何NuGet包的C++项目,则无法找到‘引用的包’选项:”
![enter image description here](https://istack.dev59.com/IkCsb.webp)
安装了NuGet软件包“freeglut”之后,“引用的软件包”和“项目主设置”会添加到“配置属性”中:
![enter image description here](https://istack.dev59.com/BZ9EC.webp)
Boost包更新:
更新 Boost 包:
您应该安装 freeglut
包来检查 "引用的包
" 和 "项目主设置
"。由于您注意到 freeglut
包和 Boost
包之间存在不同行为,我想提供更多关于 本机 NuGet 包 的信息。在将 freeglut
和 Boost
包安装到项目中后,您可以在 packages 文件夹内找到 freeglut.targets
和 boost.targets
(..\packages\freeglut.2.8.1.15\build\native & packages\boost.1.64.0.0\build\native),使用记事本或 VS 打开它们,您会注意到:
在 freeglut.targets
中:
<PropertyGroup Label="Debug and static and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-freeglut.ToLower())' == 'static' And ('$(RuntimeLibrary)' == '')">
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</PropertyGroup>
<PropertyGroup Label="Release and static and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-freeglut.ToLower())' == 'static' And ('$(RuntimeLibrary)' == '')">
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</PropertyGroup>
<PropertyGroup Label="Debug and ltcg and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) > -1 ) And '$(Linkage-freeglut.ToLower())' == 'ltcg' And ('$(RuntimeLibrary)' == '')">
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</PropertyGroup>
<PropertyGroup Label="Release and ltcg and RuntimeLibraryNull" Condition="( $(Configuration.ToLower().IndexOf('debug')) == -1 ) And '$(Linkage-freeglut.ToLower())' == 'ltcg' And ('$(RuntimeLibrary)' == '')">
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</PropertyGroup>
这将通过
PropertyGroup
在 C++ 属性中添加选项 "
Referenced Packages
" 和 "
Project Master Settings
"。
但在 boost.targets
文件中,只有:
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\include\
</ClCompile>
</ItemDefinitionGroup>
因此,“引用的包”和“项目主设置”是否添加,取决于包文件夹中的.targets文件。
如果我进入项目的“管理 Nuget 包”部分,我可以安装或卸载,但是我找不到包的任何详细信息。
在项目的“管理 Nuget 包”部分右侧,您可以注意到更多详细说明:
![enter image description here](https://istack.dev59.com/ACBCM.webp)
我已经在 MSDN 上搜索了文档,但所有页面都是关于创建软件包的,而我需要表达如何使用这样的软件包。
您可以参考文档
Consume Packages 了解如何使用软件包。
所讨论的软件包(Boost Unit Test Framework)可以使用头文件、静态链接或动态链接,并且我想知道在哪里可以决定它。
您可以在“项目 -> 属性 -> 配置属性 -> 引用软件包 -> freeglut”中进行决定。
![enter image description here](https://istack.dev59.com/uUnBs.webp)