[Bug]: CLI version 10.1.5 failing to generate swagger file on .NET 10
bug
### Describe the bug
On an API project targeting .NET 10 and referencing `Swashbuckle.AspNetCore` version `10.1.5`, trying to generate a swagger file via `swashbuckle.aspnetcore.cli` version `10.1.5` with the below command:
```
dotnet swagger tofile --output swagger.json bin\Debug\net10.0\ApiProject.dll v1
```
### Expected behavior
Should succeed via loading the correct `OpenApiDocument` type. It seems like the cli is using the old `Microsoft.OpenApi.Models` namespace to reference this type, while it should be using `Microsoft.OpenApi`.
### Actual behavior
Fails with this exception:
```
Unhandled exception. System.TypeLoadException: Could not load type 'Microsoft.OpenApi.Models.OpenApiDocument' from assembly 'Microsoft.OpenApi, Version=2.4.1.0, Culture=neutral, PublicKeyToken=3f5743946376f042'.
at Swashbuckle.AspNetCore.Cli.Program.<>c.<Main>b__1_5(IDictionary`2 namedArgs)
at Swashbuckle.AspNetCore.Cli.Program.<>c.<Main>b__1_5(IDictionary`2 namedArgs)
at Swashbuckle.AspNetCore.Cli.CommandRunner.Run(IEnumerable`1 args) in /_/src/Swashbuckle.AspNetCore.Cli/CommandRunner.cs:line 56
at Swashbuckle.AspNetCore.Cli.CommandRunner.Run(IEnumerable`1 args) in /_/src/Swashbuckle.AspNetCore.Cli/CommandRunner.cs:line 47
at Swashbuckle.AspNetCore.Cli.Program.Main(String[] args) in /_/src/Swashbuckle.AspNetCore.Cli/Program.cs:line 200
```
### .NET Version
10.0.201
关闭于 2026-04-09 3 条评论