Here's a post Using Microsoft.Extensions.DependencyInjection In .NET 5 or .NET Core Console Application on how to make use of the Microsoft.Extensions.DependencyInjection namespace in a .NET 5 or .NET Core Console Application. This namespace and it's classes specifically the ServiceProvider and ServiceCollection have been widely applied in ASP.NET Core projects specifically in Startup.cs file.