A native package contains native C++ code instead of managed code, allowing it to be used within C++ projects. (See Support for Native Projects in the Consume section.)
To be consumable in a C++ project, a package must target the
native framework. At present there are not any version numbers associated with this framework as NuGet treats all C++ projects the same.
Be sure to include
native in your <tags> section of your .nuspec to help other developers find your package by searching on that tag.
Native NuGet packages targeting
native then provide files in
\lib is not used in this case (NuGet cannot directly add references to a C++ project). A package may also include targets and props files in
\build that NuGet will automatically import into projects that consume the package. Those files must be named the same as the package ID with the
.props extensions. For example, the cpprestsdk package includes a
cpprestsdk.targets file in its
\build folder can be used for all NuGet packages and not just native packages. The
\build folder respects target frameworks just like the
\tools folders. This means you can create a
\build\net40 folder and a
\build\net45 folder and NuGet will import the appropriate props and targets files into the project. (Use of PowerShell scripts to import MSBuild targets is no longer needed.)
You can create native libraries using the NuGet CLI as for any other packages, provided that you follow the folder conventions described earlier.
The CoApp project has also created convenient C++ tools that simplify the process of generating the MSBuild files and NuGet packages from existing header and library files. You need only create a configuration script to describe the contents of the package, and then run the tools to generate the NuGet package.
Refer to these resources for more details: