A component of ASP.NET for creating RESTful web services that support HTTP-based communication between clients and servers.
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:
- 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" />
- Clean and rebuild the project:
dotnet clean
# optionally delete bin and obj folders
dotnet restore
dotnet build
- 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.