As a dotnet developer you build up collection of nuget packages / dependencies you frequently use,  but with AspNetCore I am wondering how many of these nuget packages should we still make use of.

Autofac vs Microsoft.Extensions.DependencyInjection

Microsoft has introduced their own Dependency Injection library, and I must admit this is a hard one it does a pretty good job, and a lot of libraries has created companion libraries to aid in registering there dependencies. But the one thing I miss is scanning registration the ability to use some common marker interface or naming convention to register types, also really like the registration modules systems to keep your type registrations close to the implementation.

Final thoughts, recently discovered some packages that tries to address the scanning registration issue, that might be worth evaluating, Scrutor

dotnet add package Autofac.Extensions.DependencyInjection

Serilog vs Microsoft.Extensions.Logging

Again Microsoft created there own Logging library, and it great for most things and can't fault it, but with structured logging becoming so indispensable, I lean heavily on Serilog and Seq combo, for monitoring and debugging.

dotnet add package Serilog.AspNetCore
dotnet add package Serilog.Enrichers.Environment
dotnet add package Serilog.Enrichers.Process
dotnet add package Serilog.Enrichers.Thread
dotnet add package Serilog.Exceptions
dotnet add package Serilog.Sinks.Console
dotnet add package Serilog.Sinks.Seq
dotnet add package AutofacSerilogIntegration


In combination with logging, correlating request between services are really handy, I have been making use of custom middleware to pass a common guid and enriching logs making it really easy to trace requests between services. I recently discovered CorrelationId that does exactly that. Also has a nice extenstion to wire up correlation id for HttpClients

dotnet add package CorrelationId


AspNetCore has done lots of effort making testing controllers easy, also writing middleware isn't that hard, but the thing I love about MediatR is the separation of the HTTP(controller) layer from business logic, in combination with packages like FluentValidation and SerilogTimings its a really useful pattern, and removes a lot of boilerplate code you would have written.

dotnet add pacakge MediatR.Extensions.Microsoft.DependencyInjection
dotnet add pacakge FluentValidation
dotent add package SerilogTimings

Flurl.Http vs Strongly Type HttpClient

We all have integrate with other api services, Microsoft has introduced the HttpClientFactory I found Flurl.Http library very helpful, it reduces the lines of code you would have written, around serialization and response code checking, and lots more, its almost a must for me.

dotnet add Flurl.Http


Versioning your code is a must in any environment, nothing like finding a bug, and have no idea which version of the code has caused it. MinVer makes versioning your assemblies super simple, alternative are GitVersion sometimes hard to configure at has some strong opinions about versioning.

dotnet add package MinVer