NuGet is handy for sharing code but sometimes you need to deal with raw binaries. Picking those directly out of NuGet packages can be challenging since NuGet has many complex/inter-related conventions for determining which assets are applicable.
This document will describe a technique for resolving binaries using NuGet's asset selection algorithm via DotNET CLI.
- DotNET CLI, available here: https://www.microsoft.com/net/core
- Create a project by running
dotnet new
. - Modify the
project.json
to include all of the packages you wish to resolve. - Add
"preserveCompilationContext": true
underbuildOptions
- Modify the
frameworks
and (optionally)runtimes
section to control what assets are resolved from the packages. - Run
dotnet publish
- Runtime assets (aka implementation assemblies) will be in the published output directory. If these are not needed they can be ignored.
- Compile-time assets (aka reference assemblies) will be in a
refs
subdirectory of the published output.
This sample demonstrates how to resolve all of the reference assemblies for different frameworks that shipped at .NET Core 1.0 RTM.
The project can be found here: https://gist.github.com/ericstj/b274bf0700feb12d16d2f1fd4eb34cbe
To build the set of packages referenced by this project.json one can use the text files published to https://github.com/dotnet/versions/tree/master/build-info/dotnet to determine all packages produced by the .NET team. For example, the following represent the set of library packages shipped by the CoreFx repo at 1.0 RTM. https://github.com/dotnet/versions/blob/master/build-info/dotnet/corefx/release/1.0.0/Latest_Packages.txt