在 ASP.NET Core 2.0 中,无需在<$ c $中包括单个包引用。 c> .csproj 文件。 Microsoft.AspNetCore.All 元软件包包含所有必需的软件包。我们可以将该元包包含在 .csproj 文件中,如下所示:
In ASP.NET Core 2.0 there is no need to include individual package references in the .csproj file. Microsoft.AspNetCore.All metapackage contains all the required packages. We can include this metapackage in .csproj file as:
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />.Net Core应用程序中此元软件包的主要优点和缺点是什么? (还考虑跨平台的自包含应用程序)
What are the main pros and cons of this metapackage in .Net Core applications? (Consider cross platform self contained applications also)
推荐答案创建针对.NET Core 2.0运行的ASP.NET Core 2.0应用程序时,您应该使用 Microsoft.AspNetCore.All (对于ASP.NET Core 2.1和更高版本, Microsoft.AspNetCore.App 是推荐-从ASP.NET Core 3.0 Microsoft.AspNetCore.All 将被删除),因为这是推荐的方法,对于避免一长串依赖项很有用。
When you create ASP.NET Core 2.0 application running against .NET Core 2.0, you should use Microsoft.AspNetCore.All (for ASP.NET Core 2.1 and higher, Microsoft.AspNetCore.App is recommended - From ASP.NET Core 3.0 Microsoft.AspNetCore.All will be removed) as this is the recommended approach and is useful to avoid a long list of dependencies.
发布(自包含的)应用程序时,将采用摇树方式,这意味着:构建过程将确定将使用元软件包中的哪些软件包并将从发布的文件夹中删除它们以保持较小的大小。
When publishing (self-containing) applications, tree-shaking will be applied, this means: the build process will find out which packages inside the metapackage will be used and will strip them from the published folder to keep the size small.
使用它的另一个原因是。NET Core运行时存储。 Microsoft.AspNetCore.All 包是运行时存储区的一部分,因此不需要发布(如上所述),但更重要的是,它已预先编译,因此可以启动时代也改善了。
Another reason to use it is the .NET Core Runtime Store. The Microsoft.AspNetCore.All package is part of the runtime store so it won't need to be published (as mentioned above) but more importantly, it is precompiled, so startup times improves too.
但是
更多推荐
Microsoft.AspNetCore.All元程序包的优缺点
发布评论