Share via

OpenAPI issue

Peter_1985 3,151 Reputation points
2026-02-09T03:22:11.5866667+00:00

Hi,

How to resolve it below? I ever changed OpenAPI version to 3.3.1 but there was the other issue.

User's image

Developer technologies | ASP.NET | ASP.NET API
0 comments No comments
{count} votes

Answer accepted by question author
  1. Jack Dang (WICLOUD CORPORATION) 14,955 Reputation points Microsoft External Staff Moderator
    2026-02-09T08:14:21.3266667+00:00

    Hi @Peter_1985 ,

    Thanks for reaching out.

    The issue you’re seeing is caused by a version mismatch between your packages. Specifically, Swashbuckle.AspNetCore 10.1.1 requires Microsoft.OpenApi >= 2.4.1, but your project references Microsoft.OpenApi 1.6.*. This triggers the NU1605 warning, which in your case is treated as an error.

    To resolve this, you can update your project to make the package versions compatible. Since you’re on .NET 8, here’s a simple approach:

    1. Update your project file to reference compatible versions:
    <TargetFramework>net8.0</TargetFramework>
    <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.*" />
    <PackageReference Include="Microsoft.OpenApi" Version="2.4.1" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.1" />
    
    1. Clean and rebuild the project:
    dotnet clean
    # optionally delete bin and obj folders
    dotnet restore
    dotnet build
    
    1. Make sure your code files include the correct namespace:
    using Microsoft.OpenApi.Models;
    

    Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.