Can someone explain the general idea behind providing ... Abstraction packages?
As an example, when I search for the word "hosting" in VS NuGet package manager, in the list of findings there are:
Are these all related? Some seem to be platform dependent (AspNetCore) while others are not? Is there a general rule that tells me when to choose which?
Suppose I want to implement BackgroundService in a .NET5 class library, which of these NuGets shall I install? (It seems that Microsoft.Extensions.Hosting.Abstractions works fine for me, but I had to try that out.)
Thanks
NuGet provides the tools developers need for creating, publishing, and consuming packages. Most importantly, NuGet maintains a reference list of packages used in a project and the ability to restore and update those packages from that list.
NuGet is a package manager that delivers compiled source code (DLLs) and other files (scripts and images) related to code. A NuGet package takes the form of a zip file with the extension . nupkg. This makes adding, updating, and removing libraries easy in Visual Studio applications.
The NuGet Package Manager can be used to search and install NuGet packages in the Visual Studio solution or project. Right-click the project or solution in the Solution Explorer tab, and choose Manage NuGet Packages… Alternatively, click Tools, menu, NuGet Package Manager | Manage NuGet Packages for Solution...
The idea is that a library or package that you provide would only reference the Abstraction packages for easier compatibility.
E.g. if you ship a company-wide NuGet package with some business logic in it or a custom client, you may want to use ILogger
/ ILogger<T>
for logging but not actually depend on any implementation for logging (both the built-in loggers or Serilog etc.), so you can reference the logging abstractions for these interfaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With