-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NuGet Package #1132
Comments
Feel free to make a proposal. Nearly all supported package manager support were provided by the community via pull requests. |
This comment has been minimized.
This comment has been minimized.
I have created a NuGet package for single-header distribution and added it to the default NuGet source (nuget.org). The scripts that generates this package can be found at https://github.com/hnkb/nlohmann-json-nuget/. I'll try to keep the NuGet packages up-to-date after each new release. |
Very nice! Can you provide some example code how to install the library and compile a simple program? I never used NuGet myself, but it would be good to know. |
Probably the easiest way to use NuGet packages is through Visual Studio graphical interface. Just right-click on a project (any C++ project would do) in “Solution Explorer” and select “Manage NuGet Packages…” Now you can click on “Browse” tab and find the package you like to install. Most of the packages in NuGet gallery are .NET packages and would not be useful in a C++ project. Microsoft recommends adding “native” and “nativepackage” tags to C++ NuGet packages to distinguish them, but even adding “native” to search query would still show many .NET-only packages in the list. Nevertheless, after finding the package you want, just click on “Install” button and accept confirmation dialogs. After the package is successfully added to the projects, you should be able to just build and execute the project without the need for making any more changes to build settings. A few notes:
What happens behind the scenesAfter you add a NuGet package, three changes occur in the project source directory. Of course, we could make these changes manually instead of using GUI:
How to create a NuGet packageThere is a nuget.exe command line utility which can pack files into a NuGet package (which is a zip file with a certain structure, usually with a .nupkg extension) . After this file is created, we can upload it to a package source, like http://nuget.org/, which is the default location Visual Studio uses; but you can also create local package sources, e.g. if your company does not want to share its packages with outside. To create a package, we need:
Then call nuget.exe, passing name of the .nuspec file and the package will be created. This can be added as a build step too, if needed. |
Thanks for the extensive documentation!!! I shall add a note to the README and link this issue for further information. I shall take your walk-through with the screenshots to the overworked documentation once it is done. |
Please release this library as a NuGet package.
The text was updated successfully, but these errors were encountered: