35

First of all, I apologize if this is a basic question. I tried looking this up, but for some reason, I got more confused. So, I decided to ask here. Is a dll file and a nuget package the same? Are they both just being referenced in the project?

3 Answers 3

33

When you add features to your project via a nuget package, you're just adding files to your project. It can be javascript files (like jQuery), DLLs that your project references (like Newtonsoft JSON), or a whole bunch of things (like Entity Framework or Owin/SignalR) -- anything really.

The advantage of using the nuget package system is that it tracks it all for you. It notifies you if your added packages received an update, it removes the files and unreferences them if you take the package off your project. It handles all of that for you, so you don't have to track the files that the nuget package added, place them in special folders, make sure they get copied in your builds, all that micromanaging stuff.

4
  • so is it ever better to use a reference to dlls than nuget packages when both are available?
    – niico
    May 15, 2016 at 16:29
  • 3
    niico - i use nuget packages whenever I can. It makes it easy to remove packages (references) without worrying about cleaning up DLLs in a directory somewhere. The VS integration lets me know when the nuget-references have updates to them. I really prefer Nuget versus just dropping in a referenced file.
    – Jason
    May 17, 2016 at 17:56
  • a relevant note: MS have recently started referring to nuget as a "server side package manager" and are pushing bower & other client side package managers for client side libraries like JQuery (even though they are sometimes available via nuget).
    – niico
    May 17, 2016 at 22:30
  • Also in big projects consist of multiple softwares/applications in separated repositories , the required 3rd-party NuGet packages would be downloaded and installed automatically when a company member opens a solution of another team, and they don't need to track dependencies. May 4 at 16:46
10

From the docs, https://www.nuget.org.

"What is NuGet? NuGet is the package manager for the Microsoft development platform including .NET. The NuGet client tools provide the ability to produce and consume packages. The NuGet Gallery is the central package repository used by all package authors and consumers."


A package can contain one or more dlls in addition to other assets such as config files etc.

3

You can add libraries via reference into your project but you would not notice when they were updated.

NuGet is a Visual Studio extension that makes it easy to pull in not only libraries but components, and most importantly their configuration into your visual studio project. It will help you manage your packages installed on your project and it will notify you when the package has new version released.

Let's say I created my own DLL, I could add my own DLL by reference. However, it won't be available in NuGet until I package and publish it first to make it available at the NuGet Package Gallery.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.