-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"dotnet swagger tofile" throws error in .net 8 with Swashbuckle v6.4 or 6.5 - says compatibility issue #2761
Comments
This is because the tool is compiled for .NET 7. You can fix it with
Hope this helps! |
Hi @desjoerd, I've tried this approach already as discussed in this Github issue still it seems like swagger tofile keeps on looking for .Net version 7.0.0. Upon installing Swagger CLI from Nuget, it throws error saying it's not compatible with .Net 8/any. Upon having a closer look at my output window (where I enabled debug mode in build properties), I noticed the following error response (entire stack trace):
1> C:\S2\repo\API\src\API\X.API\X.API.csproj(50,3): error MSB3073: The command "dotnet tool run swagger tofile --output swagger_patientv1.json bin\Debug\net8.0\X.API.dll patient" exited with code -532462766. |
Hi @desjoerd, |
It looks like you're running migrations in A way to workaround this is to set the dotnet environment to for example You should also do this for any IHostedService you register (basically you skip registering it for openapi generation). This is because it actually starts up the app (including the hosted services). |
Ohh... news to me. And here I thought that the tool used to pickup the SwaggerDoc files. Thanks for this info.
Question: For some weird reason it seems the command Any idea why the above would occur? |
Is a major release planned to fix this issue? |
The workaround suggested by @desjoerd worked for me. |
Confirming adding |
My fork has native support for .NET 8 as well as many fixes for it. |
I tried again today by deploying my new .net 8 app with swagger tofile target to an AKS cluster which only had .net 8 SDK installed and it threw the same error.
Adding a task beforehand to install this package was helpful but only with version 3.0.0. For 3.0.3 it throws another exception. |
Can you report the exception you are seeing with the latest version here https://github.com/Havunen/DotSwashbuckle/issues please. |
It would be nice if a version was released that also targeted .net 8, currently my pipelines have to install both 7 and 8. |
DotSwashbuckle targets only .NET 8 |
@Havunen sorry if I'm writing in the wrong github project, but the following is not built for .net 8 https://www.nuget.org/packages/Swashbuckle.AspNetCore.Cli/6.5.0#supportedframeworks-body-tab |
We will be adding |
I'm going to close this in favour of #2792, as going through triaging the open issues I'm spotting a common theme and it's easier to manage one issue. Please track that issue for further updates. If this issue isn't resolved once we have added support for |
I'm trying to generate swagger in postbuildevents, to do that I tried installing Swashbuckle CLI.
Project config:
dotnet --version: 8.0.101
Swashbuckle.Aspnetcore version: 6.4.0
Swashbuckle.Aspnetcore.Cli --> install fails saying:
Same issue popped when I updated the version to 6.5.0.
Also, if I don't do this via CMD and implement it in my csproj script like this:
It throws this error [which is not helpful at all]:
And as per Nuget's website, I can see that Swashbuckle CLI supports .net 8 but why does it say while installing the nuget package that .net 8 is not supported?
The text was updated successfully, but these errors were encountered: