Why is NuGet Pakage Restore needed?


By:
Dinesh
Devkota

Importance
of
NuGet
Package
Restore.

  • The NuGet packages doesn't have to version controlled like References files or the binary files. Can be said like they can be excluded like files with .DLL extension. In case of frequent update of these file to the Distributed version control system (DCVS), can lead the major repository bloat. It also requires a lot of time to clone.

  • Similarly, Packages can be included in the repository itself and each team member can add references to it and rather than uploading each reference from each version.
  • And, the main thing is that one can add references and may never use it. It can also be possible that the references will never be used by any other member of the group. Then, there will be a problem to clean up the project. One might also delete the package folder and that is crucial while cleaning. So, it is better to use package restore than just adding the packages that may never be used.
_________________________________________________________________________
How to Enable NuGet Pakage Restore?
Using VS UI.

Automatic Package Restore





  • Navigate to Tools>Options>Package Manager >Generel and check mark the followings.
     


  • For Specific Solution : Right click on solution in solution explorer click on Enable NuGet Package Restore
       


  • The two steps above will add “.nuget” folder in solution explorer and it will invoke MSbuid to check the “packages.config”. Vs will then install any missing packages if any of the specified NuGet is missing from the Nuget folder.



Steps For NuGet Pakage Restore.