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 在打开一个新的ASP.NET Core项目时,它提供了许多依赖项 关键的软件包以设置一个基本的ASP.NET Core应用程序。
尽管如此,该软件包不包含任何实际的dll或代码,它仅包含 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服务器使用Kestrel Web服务器,并包含IIS集成。
就应用程序本身而言,仅使用此软件包,您可以加载 将应用程序设置和环境变量转换为配置,请使用IOptions interface,并配置日志输出到控制台。
对于中间件,只包括 Microsoft.AspNetCore.Diagnostics 包 这将允许添加中间件,如ExceptionHandlerMiddleware,the 开发者异常页面中间件(DeveloperExceptionPageMiddleware)和状态码页面中间件(StatusCodePagesMiddleware)。
为了完成一个应用程序,我们不能仅仅使用元包(Metapackage),因为它不 提供足够的控制,但我们可以使用 Microsoft.AspNetCore.Mvc 或 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 应用程序,这样我们就不需要加载更多的依赖项,但实际上并没有这样做 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 依赖关系增加。
以上是C# Asp.net Core中的Metapackage是什么?的详细内容。更多信息请关注PHP中文网其他相关文章!