什么是Microsoft.AspNetCore
https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/metapackage-app
ASP.NET Core共享框架(Microsoft.AspNetCore.App)包含由Microsoft开发和支持的程序集。当安装NET Core 3.0或更高版本SDK时,安装Microsoft.AspNetCore.App
。共享框架是安装在计算机上并包括运行时组件和目标包的一组程序集(.dll文件)。
- 面向
Microsoft.NET.Sdk.Web
SDK的项目隐式引用Microsoft.AspNetCore.App
框架。
对于这些项目,不需要其他引用:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
...
</Project>
ASP.NET Core共享框架:
- 不包括第三方依赖项。
- 包括ASP.NET Core团队支持的所有包。
使用ASP.NET Core共享框架
随着.NET Core 3.0发布,许多ASP.NET Core程序集不再作为包发布到NuGet。而是改为将这些程序集包含在通过.NET Core SDK和运行时安装程序安装的Microsoft.AspNetCore.App共享框架中。若要查看不再发布的包列表,请参阅删除过时的包引用。
自.NET Core 3.0起,使用Microsoft.NET.Sdk.Web MSBuild SDK的项目隐式引用此共享框架。使用Microsoft.NET.Sdk或Microsoft.NET.Sdk.RazorSDK的项目必须引用ASP.NET Core,才能使用共享框架中的ASP.NET Core API。
若要引用ASP.NETCore,请将以下<FrameworkReference>
元素添加到项目文件:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>
Microsoft.AspNetCore Nuget包
集中组
名称 | 备注 |
---|---|
Microsoft.AspNetCore | >= .NET Standard 2.0; |
Http组
名称 | 备注 |
---|---|
Microsoft.AspNetCore.Http | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Http.Features | >= .NET 6.0; >= .NET Standard 2.0; >= .NET Framework 4.6.1; |
Microsoft.AspNetCore.Http.Abstractions | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Http.Extensions | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Http.Connections.Common | >= .NET 7.0; >= .NET Standard 2.0; >= .NET Framework 4.6.2; |
Microsoft.AspNetCore.HttpOverrides | >= .NET Standard 2.0; |
Microsoft.AspNetCore.WebUtilities | >= .NET Standard 2.0; |
Hosting组
名称 | 备注 |
---|---|
Microsoft.AspNetCore.Hosting | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Hosting.Abstractions | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Hosting.Server.Abstractions | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Hosting.WindowsServices | >= .NET 7.0; |
Mvc组
名称 | 备注 |
---|---|
Microsoft.AspNetCore.Mvc | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.Core | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.Abstractions | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.Formatters.Json | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.DataAnnotations | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.ApiExplorer | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.ViewFeatures | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.NewtonsoftJson | >= .NET 7.0; |
Microsoft.AspNetCore.Mvc.Razor | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.Razor.Extensions | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.Localization | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.TagHelpers | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.Cors | >= .NET Standard 2.0; |
Microsoft.AspNetCore.Mvc.RazorPages | >= .NET Standard 2.0; |
Microsoft.System Nuget包
System组
名称 | 备注 |
---|---|
System.Threading.Tasks.Extensions | >= .NET Core 2.1; >= .NET Standard 1.0; >= .NET Framework 4.6.1; |
System.Diagnostics.DiagnosticSource | >= .NET 5.0; >= .NETStandard 2.0; >= .NETFramework 4.6.1; |
System.Buffers | >= .NET Core 2.0; >= .NET Standard 1.1; >= .NET Framework 4.5; |
System.Memory | >= .NET Core 2.1; >= .NET Standard 1.1; >= .NET Framework 4.6.1; |
参考
- Microsoft.AspNetCore in Nuget
- 使用类库中的 ASP.NET Core API
- Microsoft.AspNetCore.App for ASP.NET Core
- Deep-dive into .NET Core primitives, part 2: the shared framework
- 乘风破浪,遇见最佳跨平台跨终端框架.Net Core/.Net生态 - 官方扩展集锦(Microsoft.Extensions on Nuget)