Choosing NuGet package management format for new projects

Visual Studio

7 years ago

The new Visual Studio 2017 comes with support for a new PackageReference package management format, which replaces the old Packages.config and project.json formats and puts the package references directly in the project file.This is bound to be the standard for NuGet in the future (or the one NuGet standard to rule them all, as they say :-) ), but is not supported in older versions of Visual Studio. Depending on your scenario, you might want to choose the appropriate package management format that suits your needs. Luckily, Visual Studio offers you this option via a new setting. To allow selection of the package management format for new projects, click on Tools in the menu strip and choose Options. In the options window, navigate to the NuGet Package Manager section in the tree on the left.

NuGet Package Management options

NuGet Package Management options

As you can see, you can not only select the default package management format, but you can also opt to get a choice of format selection every time you install the first package into a project. When you do this, the next time you install a NuGet package in a new project, you will be presented with the following dialog:

Choose NuGet Package Manager Format

Choose NuGet Package Manager Format

Summary

We have been on quite a roller-coaster with constant changes of NuGet package management formats, but it seems we finally have a definite winner that should be here for the years to come. Visual Studio however doesn't yet force nor recommend you to use this format, but luckily you can choose to do it manually with a little more work.