I have an App Service that has been running in Azure for a while. I have just updated it to .NET 6.0 (and installed Swashbuckle.aspnetcore.cli v6.2.3 locally).
I cannot publish to Azure. When I first tried it told me it couldn't find aspnetcore3.0 and the only installed versions it could find were .NET 5.1.4 and .NET 6.0.1.
Following instructions here: https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1485
I added a global.json to my project:
{
"sdk":
{
"version": "6.0.1",
"rollForward": "latestPatch"
}
}
Now when I try and publish I get the following error:
Failed to install DotNet CLI tool 'swashbuckle.aspnetcore.cli'. Error dotnet tool restore
Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application 'tool' does not exist.
* You intended to execute a .NET SDK command:
A compatible installed .NET SDK for global.json version [6.0.1] from [C:\Projects\MyProject\global.json] was not found.
Install the [6.0.1] .NET SDK or update [C:\Projects\MyProject\global.json] with an installed .NET SDK:
How can I publish my app service?
To anyone else that finds this issue, I finally fixed it by editing the file "dotnet-tools.json" in the ".config" folder in the project root folder, and changing the version of swashbuckle.aspnetcore.api from 5.6.3 to 6.3.0.
I also updated to swashbuckle 6.3.0, and changed global.json to be:
{
"sdk":
{
"version": "5.6.3",
"rollForward": "latestMajor"
}
}
Note the use of latestMajor rather than latestPatch.