This answer mentions the following method to link to the static version of a C++ library [in this case, "freeglut"] installed via Nuget:
Project->Properties->Configuration Properties->Referenced Packages->freeglut->Linkage (select static)
With Visual Studio 2015 I can't find "Referenced Packages". The only explicit reference to Nuget packages that I have is the packages.config xml file. If I go to the "Manage Nuget packages" section of the project I can install or un-install but I can't find any detail of the package.
I have searched msdn for documentation but all the pages are devoted to the creation of a package, while I need to espress the way to consume such a package. The package in question (Boost Unit Test Framework) can be used header-only, with static or with dynamic linkage and I would like to know where I can decide it.
Maybe I am getting old, but Nuget is a bit too magic for me...
UPDATE
This is what I am seeing - you can see that there are Nuget packages installed, in particular boost, but that under the Configuration properties there is no link to "Referenced packages":
For completeness, the version of VS 2015 Enterprise is:
14.0.25431.01 Update 3
and I have checked that when I installed the Boost Test Package I got both the static (.lib) and dynamic (.dll) linkage versions, since the files for my VS version are present in the packages folder.
With Visual Studio 2015 I can't find "Referenced Packages".
It depends on whether you have installed freeglut package into your project. If you create a C++ project without any NuGet package installed, you could not find the "Referenced Packages":
After installed the nuget package "freeglut
", the "Referenced Packages
" and "Project Master Settings
" would add to the Configuration Properties
:
Update for Boost Package:
You should install the package freeglut
to check the "Referenced Packages
" and "Project Master Settings
". Since you noticed the different behavior between the package freeglut
and Boost
, I would like provide more about Native NuGet packages. After installed the freeglut
and Boost
in to your project, you can find the freeglut.targets
and boost.targets
in the packages folder(..\packages\freeglut.2.8.1.15\build\native & packages\boost.1.64.0.0\build\native), open them with notepad or VS, you will noticed that:
In 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>
This will add the options "Referenced Packages
" and "Project Master Settings
" via PropertyGroup
in to the C++ properties.
But in the boost.targets
file, only:
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory)..\..\lib\native\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
</ItemDefinitionGroup>
So whether the "Referenced Packages
" and "Project Master Settings
" will be added is based on the .targets file in the package`s folder.
If I go to the "Manage Nuget packages" section of the project I can install or un-install but I can't find any detail of the package.
On the right of the "Manage Nuget packages" section of the project, you can notice some more detail Description:
I have searched msdn for documentation but all the pages are devoted to the creation of a package, while I need to espress the way to consume such a package.
You can refer to the document Consume Packages for how to consume a package.
The package in question (Boost Unit Test Framework) can be used header-only, with static or with dynamic linkage and I would like to know where I can decide it.
You can decide it on the Project->Properties->Configuration Properties->Referenced Packages->freeglut:
Boost is using auto-linking. It means, the Boost source code decides which library (file) to use depending on build environment and configuration.
Update Here's the process
I agree, the process is not obvious. To improve it, Boost should finalize their modularization first. I mean, when Boost libraries (headers and binaries) can be shipped separately.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With