使用 Visual Studio 2015,我找不到“引用的包”。
这取决于您是否在项目中安装了 freeglut 软件包。如果您创建一个没有安装任何 NuGet 包的 C++ 项目,则找不到“Referenced Packages”:
安装 nuget 包后“freeglut”,“Referenced Packages”和“Project Master Settings”将添加到Configuration Properties:
Boost 包更新:
您应该安装包freeglut 以检查“Referenced Packages”和“Project Master Settings”。由于您注意到包 freeglut 和 Boost 之间的不同行为,我想提供更多关于 Native NuGet packages 的信息。将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 将选项“Referenced Packages”和“Project Master Settings”添加到 C++ 属性中。
但在boost.targets 文件中,只有:
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
所以是否添加“Referenced Packages”和“Project Master Settings”取决于包文件夹中的.targets文件。
如果我转到项目的“管理 Nuget 包”部分,我可以安装或卸载,但我找不到包的任何详细信息。
在项目的“管理 Nuget 包”部分的右侧,您可以看到一些更详细的说明:
我已经在 msdn 中搜索了文档,但所有页面都专门用于创建包,而我需要明确使用这种包的方式。
如何使用包可以参考文档Consume Packages。
有问题的包(Boost 单元测试框架)可以仅用于标头,具有静态或动态链接,我想知道我可以在哪里决定它。
你可以在Project->Properties->Configuration Properties->Referenced Packages->freeglut上决定: