In my ASP.NET Core-6 Web API, I installed this NuGet package:
<PackageReference Include="microsoft.aspnetcore.mvc.versioning.apiexplorer" Version="5.0.0" />using Microsoft.AspNetCore.Builder;using Microsoft.AspNetCore.Mvc;using Microsoft.Extensions.DependencyInjection;using System.Diagnostics.CodeAnalysis;using System.Text.Json;namespace WebApi.API.V1{ [ExcludeFromCodeCoverage] internal static class ApiStartup { public static void AddMyApi(this IServiceCollection services) { services.AddHealthChecks(); services.AddControllers() .AddControllersAsServices() .SetCompatibilityVersion(CompatibilityVersion.Version_3_0) .AddJsonOptions(c => c.JsonSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase); } }}
I got these errors:
Warning ASP5001 'CompatibilityVersion' is obsolete: 'This API is obsolete and will be removed in a future version. Consider removing usages.'
Warning CS0618 'CompatibilityVersion.Version_3_0' is obsolete: 'This CompatibilityVersion value is obsolete.'
Warning ASP5001 'MvcCoreMvcBuilderExtensions.SetCompatibilityVersion(IMvcBuilder, CompatibilityVersion)' is obsolete: 'This API is obsolete and will be removed in a future version. Consider removing usages.'
How do resolve it?
Thanks