Friday, November 17, 2017

Difference between Nuget and Chocolatey

NuGet is designed to allow you to easily add code libraries to your project. Things like JSON.NET, Entity Framework, etc.


Chocolatey is actually built on top of the NuGet package system, but it is designed to fill a different need. Chocolatey wraps up applications and other executables and makes it easy to install them on your computer. For example, tools like Git and Notepad++, etc. can be easily installed with a command like: cinst git.


To know more about chocolate and how to install it please refer my earlier blog post on W3LC : http://www.w3lc.com/2017/11/what-is-chocolatey-and-how-to-install.html


https://chocolatey.org/packages has a list of all the applications that can be installed.


If you have an open source project which is a library that is to be used in other developers' projects, then you should submit it to NuGet.


If it is an application that users would normally install, then create a Chocolatey package that users can easily install and update from the command line.


Details of different Package manager tools and where does Chocolate fits in:


OneGet has been renamed to Package management. It's core provides you with discovery and installation/uninstallation of various packages. OneGet is often referred to as a "package manager manager".

OneGet is a part of WMF 5 installation. Think of this as the "central concept" in the big picture. Now let's talk about packages.

Packages are fetched through package providers. E.g. PowerShellGet is one package provider for OneGet. Powershell gallery is a package source of of PowershellGet (PSGet). A provider can have multiple sources where it can search for it's packages.

E.g for the nuget-package provider; you can easily add the sources to the public nuget gallery and register your own e.g. myget source so it can be used when searching for packages.

Chocolatey is just another example of a package provider. Earlier it had to be installed and was a seperate module with it's own logic. The new Chocolatey provider conforms to the new framework of installing / managing packages.

So on a more conceptual level; a package provider itself contains information on how to install and search it's sources (sources can be registered/unregistered for each and every provider); whilst OneGet (Package management, package manager manager) works on the level above, managing package providers and interfacing this all for you.

OneGet glues it all together; while the providers itself knows how to handle packages based on it's registered sources.

Hope this explains it on the conceptual level.

See also this nice blogpost here explaining a few things more in detail:https://blogs.technet.microsoft.com/packagemanagement/2015/05/05/10-things-about-oneget-that-are-completely-different-than-you-think/

If you want to play around with package providers and sources :

 Get-PackageProvider # -Shows package providers installed on your machine)
 Find-PackageProvider # -Find online package providers you can pull down and install)
 Get-PackageSource # -List all package sources, with it's provider name)
 Register-PackageSource # -Register new package source for a provider)





No comments:

Post a Comment