Fix Swashbuckle CLI version mismatch for v10.x compatibility#159
Draft
Fix Swashbuckle CLI version mismatch for v10.x compatibility#159
Conversation
Copilot started work on behalf of
Mathieu Gamache (PrincessMadMath)
January 5, 2026 16:01
View session
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Co-authored-by: PrincessMadMath <8277266+PrincessMadMath@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix incompatibility with Swashbuckle.AspNetCore v10.x
Fix Swashbuckle CLI version mismatch for v10.x compatibility
Jan 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Swashbuckle.AspNetCore v10.0+ upgraded from Microsoft.OpenApi v1.x to v2.3.0, introducing breaking API changes. The hardcoded CLI version (9.0.4) caused
TypeLoadExceptionwhen generating specs for projects using v10.x, as the v9 CLI expected v1.x types but encountered v2.x types.Changes
Swashbuckle.AspNetCore.SwaggerGen.dllin the application's output directory usingFileVersionInfo9.0.6,10.0.1)9.0.4if detection fails (invalid path, missing DLL, or malformed version)Implementation
The CLI tool version now matches the application's Swashbuckle version, preventing type loading conflicts across major version boundaries.
Original prompt
This section details on the original issue you should resolve
<issue_title>Incompatibility with Swashbuckle.AspNetCore v10.x due to hardcoded CLI version 9.0.4</issue_title>
<issue_description>Describe the bug
After upgrading Swashbuckle.AspNetCore from version 9.0.6 to 10.0.1 (which includes Microsoft.OpenApi v2.3.0), the Workleap.OpenApi.MSBuild package (v0.12.3) fails to generate OpenAPI specifications during the build process.
The build completes successfully for the main projects, but the OpenAPI spec generation step fails with a
TypeLoadExceptionwhen trying to loadMicrosoft.OpenApi.Models.OpenApiDocumentfrom the Microsoft.OpenApi assembly.To Reproduce
Steps to reproduce the behavior:
Swashbuckle.AspNetCorepackage reference from version 9.0.6 to 10.0.1 in a project that usesWorkleap.OpenApi.MSBuild(v0.12.3)dotnet buildon the solutionExpected behavior
The OpenAPI specification should be generated successfully during the build process, as it did with Swashbuckle.AspNetCore v9.0.6.
Error Output
Environment (please complete the following information):
Additional context
The root cause is that Swashbuckle.AspNetCore v10.0.1 upgraded its dependency on Microsoft.OpenApi from v1.x to v2.3.0, which introduced breaking changes in the API. The
Microsoft.OpenApi.Modelsnamespace and types likeOpenApiDocumenthave been restructured in v2.x.The Workleap.OpenApi.MSBuild package (v0.12.3) uses Swashbuckle.AspNetCore.Cli internally to generate OpenAPI specs, but this CLI tool is not compatible with the new Microsoft.OpenApi v2.x API surface.
The issue is in the
SwaggerManager.csfile where the Swashbuckle CLI version is hardcoded:Source: SwaggerManager.cs:L7
This hardcoded version installs
Swashbuckle.AspNetCore.Cliv9.0.4, which depends on Microsoft.OpenApi v1.x. When the consuming application uses Swashbuckle.AspNetCore v10.x (with Microsoft.OpenApi v2.x), there's a version mismatch between:This causes the
TypeLoadExceptionwhen the CLI tool tries to load types from the incompatible Microsoft.OpenApi v2.x assembly.Related Links:
</issue_description>
Comments on the Issue (you are Copilot in this section)
Mathieu Dumoulin (@MatDumoulin) +1We faced the same issue while trying to migrate SG Protect to .Net 10</comment_new>
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.