.NET Top NuGet Packages Every Developer Should Know in 2022

There are a lot of implementations for commonly-used concepts, and most of the trivial problems you face were solved by someone. When facing a new programming challenge, it is always a good habit to check for existing solutions. Maybe they are open for usage and can save a lot of time.

2022 Top NuGet Packages

I want to share the list of the most used .NET NuGet packages that I prefer to use. They are pretty helpful in your day-to-day development life.

note: You are welcome to tell in comments about any package which you think helps developers a lot but was not added to this list.

Flurl

A simple library that allows building URLs together with Fluent Http makes any HTTP calls much more effortless. Also, creators added support for a convenient way of using it during unit testing. In most cases, it helps when you need to interact with third-party API.

1
2
dotnet add package Flurl
dotnet add package Flurl.Http

Read more in offiacial documentation:

https://flurl.dev/docs/fluent-http/

Polly

This library provides great resilient and fault-tolerant tools. It allows implementing circuit breakers, retries, fallbacks, rate limits, and timeouts. If your application interacts with third-party services, you must use this package to configure resilient policies when external service goes down.

1
dotnet add package Polly

Take a look at this article with the best ways to use Polly:

How to Use Polly in .NET

FluentValidation

The package helps to validate models with business rules. It provides a convenient way to describe rules for model properties. It contains a lot of built-in validators, and you also can build your own, which adheres to your business rules.

1
dotnet add package FluentValidation

The next article shows how to leverage FluentValidation for input model validation with ASP.NET:

Model Validation Using FluentValidation in ASP.NET

AutoMapper

Handy object to object mapper. It helps avoid routine property mapping and provides an interface on how to describe property mapping from input object to output object.

It`s a good practice to avoid exposing internal entities. This approach requires mapping from the input model to internal entities and mapping from the internal to the output model. AutoMapper makes this process much more manageable.

1
dotnet add package AutoMapper

NSwag

Working with web API, it`s a good practice to provide documentation for consumers. OpenAPI is a standard for API documentation, and NSwag is a package that adds the ability to generate API documentation on the fly without additional efforts according to OpenAPI specification.

NUnit

There are few testing frameworks available for .NET. NUnit is one of them. It offers a good variety of tools for unit tests. Probably most developers use it or xUnit, which is pretty similar to this one.