domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.25k stars 1.31k forks source link

.Net 8 rc-2 support #2725

Closed Berthelmaster closed 7 months ago

Berthelmaster commented 1 year ago

Hi!

We really appreciate your package, we're currently upgrading our stuff to dotnet rc2 and we get the following error:


Tool 'swashbuckle.aspnetcore.cli' (version '6.5.0') was restored. Available commands: swagger

  Restore was successful.
  You must install or update .NET to run this application.

  App: /home/vsts/.nuget/packages/swashbuckle.aspnetcore.cli/6.5.0/tools/net7.0/any/dotnet-swagger.dll
  Architecture: x64
  Framework: 'Microsoft.NETCore.App', version '7.0.0' (x64)
  .NET location: /opt/hostedtoolcache/dotnet/

  The following frameworks were found:
    8.0.0-rc.2.23479.6 at [/opt/hostedtoolcache/dotnet/shared/Microsoft.NETCore.App]

  Learn more:
  https://aka.ms/dotnet/app-launch-failed

  To install missing framework, download:
  https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0&arch=x64&rid=linux-x64&os=ubuntu.22.04

Could it be possible to create a beta package that targets .NET 8?

We really appreciate it!

david-brink-talogy commented 1 year ago

I feel like there's a larger question here. This repo hasn't seen a commit for 9 months and .NET 8 is a month away. @domaindrivendev, can you provide some insight into the near-term plans for Swashbuckle and also .NET 8?

theonesuperdaveXTR commented 1 year ago

I was able to get the CLI to run successfully targeting net8.0 using the .Net 8 rc-2 SDK. swashbuckle.aspnetcore.cli was upgraded for version 6.5.0; it failed when the CLI was version 6.3.1.

However, I am now seeing an issue similar to @Berthelmaster when I target net6.0 (existing apps), and use the CLI, regardless of version.

Error: " Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (0x80131040) File name: 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'"

It also seems to ignore the global.json file which I used to downgrade the SDK to version 6.0.414. It is still using the .Net 8 rc-2 SDK and fails accordingly because it is not being used for that build.

global.json

{
    "sdk": {
        "version": "6.0.414"
    }
}

Error: "C:\Program Files\dotnet\sdk\8.0.100-rc.2.23502.2\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.Shared.targets(80,5): error MSB4062: The "CheckIfPackageReferenceShouldBeFrameworkReferen ce" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\8.0.100-rc.2.23502.2\Sdks\Microsoft.NET.Sdk\targets..\tools\net8.0\Microsoft.NET.Build.Tasks.dll. Could not load file or ass embly 'System.Runtime, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. Confirm that the declaration is correct, that the asse mbly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users[me]]\AppData\Local\Temp\db20ce59-91b4-426a-84c 9-127c9c92f469\restore.csproj] [C:\code[app]\src\api\api.csproj]

Package "swashbuckle.aspnetcore.cli" failed to restore, due to Microsoft.DotNet.ToolPackage.ToolPackageException: The tool package could not be restored. at Microsoft.DotNet.Tools.Tool.Install.ProjectRestorer.Restore(FilePath project, PackageLocation packageLocation, String verbosity) at Microsoft.DotNet.ToolPackage.ToolPackageInstaller.InstallPackageToExternalManagedLocation(PackageLocation packageLocation, PackageId packageId, VersionRange versionRange, String targetFramewor k, String verbosity) at Microsoft.DotNet.Tools.Tool.Restore.ToolRestoreCommand.InstallPackages(ToolManifestPackage package, Nullable`1 configFile)

Restore failed. "

Please advise on the availability of a new package with backwards compatibility.

Berthelmaster commented 1 year ago

I'm getting a little bit worried, we scheduled to upgrade to dotnet 8 next month, anybody has heard from @domaindrivendev? @theonesuperdaveXTR @psiservices-dbrink what do you plan to do? We're considering migrating away from Swashbuckle :(

theonesuperdaveXTR commented 1 year ago

Swashbuckle works just fine at runtime, having used it in many projects for years. If you cannot get its CLI to work, then you might go with that option.

I did get version 6.5.0 of the CLI to work and generate both YAML and JSON files while my app was targeting net8.0. This was using the .Net 8 RC2 SDK.

You might also try the global.json file to downgrade the SDK, just to see if anything will work for you. Hope that helps!

david-brink-talogy commented 1 year ago

@Berthelmaster, I'm still evaluating the situation. The build had been broken for a bit and I just opened a PR to fix it late last week. It was the first good build since August and I hope it will trigger some activity.

Are you looking at NSwag as an alternative?

Berthelmaster commented 1 year ago

@psiservices-dbrink Yes we do! We use it already for api client generation, so that was also our goto, I have no tried using it to generate swagger files though

stigrune commented 12 months ago

I encountered the same problem and used this workaround. Simply set the environment variable DOTNET_ROLL_FORWARD=LatestMajor I haven't observed any issues related to the workaround so far.

DaveK-Rocketmakers commented 12 months ago

I have also hit an issue trying to run the CLI with the recently released .NET 8 SDK

ramondeklein commented 11 months ago

It looks like @domaindrivendev has abondoned Swashbuckle. I checked his LinkedIn profile to check if he has left Unsplash, but according to his profile he is still working there. I can imagine that focus shifts to another project, but it would be nice to have a statement from him, so either the community can take over or he may resume the development.

Trolldemorted commented 10 months ago

By now 8.0.0 has landed and the problem persists.

You must install or update .NET to run this application.

App: /home/benni/.nuget/packages/swashbuckle.aspnetcore.cli/6.5.0/tools/net7.0/any/dotnet-swagger.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '7.0.0' (x64)
.NET location: /usr/share/dotnet/

The following frameworks were found:
  8.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0&arch=x64&rid=linux-x64&os=ubuntu.22.04

Given the lack of other contributions on github, I hope he is alright. Given the lack of alternatives to swashbuckle, this is a rather big problem for the asp.net ecosystem :(

Nisden commented 10 months ago

By now 8.0.0 has landed and the problem persists.

You must install or update .NET to run this application.

App: /home/benni/.nuget/packages/swashbuckle.aspnetcore.cli/6.5.0/tools/net7.0/any/dotnet-swagger.dll
Architecture: x64
Framework: 'Microsoft.NETCore.App', version '7.0.0' (x64)
.NET location: /usr/share/dotnet/

The following frameworks were found:
  8.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=7.0.0&arch=x64&rid=linux-x64&os=ubuntu.22.04

Given the lack of other contributions on github, I hope he is alright. Given the lack of alternatives to swashbuckle, this is a rather big problem for the asp.net ecosystem :(

The main alternative right now would be https://github.com/RicoSuter/NSwag

soroshsabz commented 9 months ago

ITNOA

related to #2707

soroshsabz commented 9 months ago

related to #2759

Havunen commented 8 months ago

I have created a fork called DotSwashbuckle for .NET 8 and forward, it fixes some long lasting issues.

Berthelmaster commented 8 months ago

Ahh too late, we already switched all our applications to Nswag 😅

martincostello commented 7 months ago

We have a number of issues open that are related to adding support for .NET 8, which we plan to do in a future release in the near future.

martincostello commented 7 months ago

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 net8.0, please open a new issue.