NuGet: Managing Dependencies in .NET
A guide to using NuGet, the official package manager for the Microsoft development platform.
1 Loading...
NuGet: Managing Dependencies in .NET
If you work with C# or .NET, you use NuGet. It is the central repository for over 300,000 unique packages.
How to Use NuGet
There are three main ways to interact with NuGet:
- Visual Studio GUI: Right-click project -> “Manage NuGet Packages”. The classic point-and-click interface.
- .NET CLI: The modern, cross-platform way.
dotnet add package Newtonsoft.Json - Package Manager Console: A PowerShell console inside VS.
Install-Package Newtonsoft.Json
Managing Versions
Dependencies are stored in your project file (.csproj).
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
Private Feeds
For enterprise development, NuGet supports private feeds (like Azure Artifacts or GitHub Packages), allowing you to share code internally securely.
Conclusion
NuGet is essential for the modern .NET developer. With the new CLI tools, it is faster and easier than ever to manage dependencies on Windows, Mac, or Linux.