Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why use NuGet over installing libraries directly on my machine

I don't get it - can someone please explain to me why I should use NuGet rather than installing a bunch of libraries via a setup.exe or MSI? What advantage is there?

For example is it better to install Entity Framework 4.3 via NuGet rather than downloading the setup? Also, if I install entity framework via NuGet then is it available to any new solutions or projects that I create (bit confused here).

Basically what does NuGet do that a normal install doesn't do (or vice versa!)

like image 399
Calanus Avatar asked Mar 20 '12 09:03

Calanus


People also ask

When should I use NuGet package?

NuGet provides the tools developers need for creating, publishing, and consuming packages. Most importantly, NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.

Is it safe to use NuGet packages?

NuGet doesn't manage trust. Even if it did, you would still have to be concerned about trusting what NuGet trusts. You should absolutely be concerned about the safety of the code in a NuGet package. You should be concerned about the safety of any code you are not familiar with.

What happens when you install a NuGet package?

NuGet creates a subfolder for each package identifier, then creates subfolders for each installed version of the package. NuGet installs package dependencies as required. This process might update package versions in the process, as described in Dependency Resolution.

What is a NuGet package and what is it used for?

NuGet is a package manager that delivers compiled source code (DLLs) and other files (scripts and images) related to code. A NuGet package takes the form of a zip file with the extension . nupkg. This makes adding, updating, and removing libraries easy in Visual Studio applications.


1 Answers

Besides making it simple to add a package to your project, I think NuGet's biggest advantage is dependency management.

NuGet allows project owners to package their libraries as packages. Before, if they depended on other libraries like log4net, they would include those assemblies in their setup/zip file and upload to their web site.

With NuGet, they simply add a reference to these external packages in the .nuspec file. When NuGet installs the package, it will see that there are dependencies and will automatically download and install those packages as well. It also supports conflict management so that if 2 packages depends on different versions, it will figure out the correct one to install.

I think the best way to determine if NuGet will work for you is to actually try using it. I'm sure that once you do, you'll realize that it has many benefits.

like image 162
Kiliman Avatar answered Sep 27 '22 22:09

Kiliman