Home  >  Article  >  Backend Development  >  What is Metapackage in C# Asp.net Core?

What is Metapackage in C# Asp.net Core?

WBOY
WBOYforward
2023-08-22 10:25:13896browse

It is known that Microsoft.AspNetCore package is one of the packages added to many ASP.NET Core templates.

The Microsoft.AspNetCore package is repeatedly included as one of the usual project When opening a new ASP.NET Core project, it provides many dependencies Key packages to set up a basic ASP.NET Core application.

Nonetheless, this package does not contain any actual dll or code, it only contains a series of dependencies on additional packages. By adding this package to your project, you bring in all the relevant packages along with their dlls on which it depends and it is called a metapackage.

Specifically, the packages it lists are −

Microsoft.AspNetCore.Diagnostics
Microsoft.AspNetCore.Hosting
Microsoft.AspNetCore.Routing
Microsoft.AspNetCore.Server.IISIntegration
Microsoft.AspNetCore.Server.Kestrel
Microsoft.Extensions.Configuration.EnvironmentVariables
Microsoft.Extensions.Configuration.FileExtensions
Microsoft.Extensions.Configuration.Json
Microsoft.Extensions.Logging
Microsoft.Extensions.Logging.Console
Microsoft.Extensions.Options.ConfigurationExtensions
NETStandard.Library

The versions of these packages you will receive depends on which version of the Microsoft.AspNetCore package you install.

These dependencies deliver the primary basic libraries for setting up a basic ASP.NET Core server uses Kestrel web server and includes IIS integration.

As far as the application itself is concerned, just using this package you can load To convert application settings and environment variables into configurations, use IOptions interface, and configure log output to the console.

For middleware, only include the Microsoft.AspNetCore.Diagnostics package This will allow adding middleware such as ExceptionHandlerMiddleware, the Developer Exception Page Middleware (DeveloperExceptionPageMiddleware) and Status Code Page Middleware (StatusCodePagesMiddleware).

In order to complete an application, we cannot just use metapackage (Metapackage), because it does not provides sufficient control, but we can use Microsoft.AspNetCore.Mvc or Microsoft.AspNetCore.MvcCore package to add MVC capabilities to our application, and also some other packages would be needed.

The metapackage just try to use a number of packages that can be applied to many application so that we don't need to load more dependencies, but don't actually do that that because it requires other packages as well. Thus, if the number of packages is large then the dependencies increases which impacts the real use of metapackage. For example, one of the dependencies on which the Microsoft.AspNetCore depends is the NETStandard.Library package, which is also a metapackage and hence the Dependencies increase.

The above is the detailed content of What is Metapackage in C# Asp.net Core?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete