Microsoft.AspNetCore 已被弃用
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>net8.0</TargetFramework> <ImplicitUsings>enable</ImplicitUsings> <Nullable>enable</Nullable> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <NoWarn>1701;1702;8618;</NoWarn> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> <NoWarn>1701;1702;8618;</NoWarn> </PropertyGroup> <ItemGroup> <PackageReference Include="NLog" Version="5.2.8" /> <FrameworkReference Include="Microsoft.AspNetCore.App" /> </ItemGroup> </Project>
csproj文件中加入
<FrameworkReference Include="Microsoft.AspNetCore.App" />