Skip to content
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

Swashbuckle looking for .NET 7 in a .NET 8 project #2707

Closed
zahalzel opened this issue Sep 14, 2023 · 9 comments
Closed

Swashbuckle looking for .NET 7 in a .NET 8 project #2707

zahalzel opened this issue Sep 14, 2023 · 9 comments

Comments

@zahalzel
Copy link

Running Swashbuckle 6.5.0 on a .NET 8 project, I only have .NET 8 SDK and runtimes installed, running into this error:

dotnet swagger tofile --serializeasv2 --output "C:\Users\zahalzel\source\repos\WebApplication1010\WebApplication1010\bin\Debug\net8.0\swagger.json" "C:\Users\zahalzel\source\repos\WebApplication1010\WebApplication1010\bin\Debug\net8.0\WebApplication1010.dll" v1

You must install or update .NET to run this application.
App: C:\Users\zahalzel\.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: C:\Program Files\dotnet\
The following frameworks were found:
  8.0.0-rc.1.23419.4 at [C:\Program Files\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=win-x64&os=win10
@olegd-superoffice
Copy link

@zahalzel You can set environment variable DOTNET_ROLL_FORWARD=LatestMajor and it will run. Not sure if this would have any side-effects though.

@Berthelmaster
Copy link

@zahalzel Did what @olegd-superoffice mentioned work? We have the same problem now :(

@zahalzel
Copy link
Author

@Berthelmaster I was able to get our scenario to work by setting two environment variables:
DOTNET_ROLL_FORWARD=LatestMajor
DOTNET_ROLL_FORWARD_TO_PRERELEASE=1

@bexxx
Copy link

bexxx commented Nov 23, 2023

I can confirm this work for me using an Azure DevOps build pipeline.

I've added
variables:
DOTNET_ROLL_FORWARD: LatestMajor

to the build and it started to work.

@harboe
Copy link

harboe commented Dec 11, 2023

just wanna add if you're using the .csproj to build your API files. it's possible to add the environment variables to the Exec command like:

<Exec Command="dotnet swagger tofile --output "v1.json" $(MSBuildProjectDirectory)/$(OutputPath)$(AssemblyName).dll v1" EnvironmentVariables="DOTNET_ROLL_FORWARD=LatestMajor" />

@Lonli-Lokli
Copy link

Is this package still maintained?? No commits for the last 11 months

@soroshsabz
Copy link

Is this package still maintained?? No commits for the last 11 months

ITNOA

related to #2759

@Havunen
Copy link

Havunen commented Feb 18, 2024

This is fixed in DotSwashbuckle, can you test using it please.
https://github.com/Havunen/DotSwashbuckle
https://www.nuget.org/packages/DotSwashbuckle.AspNetCore

@martincostello
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants