Kudu 不支持 .net core 3.1:无法从 bitbucket 自动部署我的 .Net core 3.1 功能

Kudu not supported .net core 3.1: can not autodeploy my .Net core 3.1 function from bitbucket

我使用 bitbucket 将我的函数应用程序部署到 azure:当我在 Bitbucket 中签入 master 时,我的代码被部署到 Azure。

效果很好,但现在我将函数应用程序从 .net core 2.2 升级到 3.1 并且...

现在我遇到了这个异常:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling function App deployment with dotnet.exe.
D:\Program Files (x86)\dotnet\sdk.2.109\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1.  Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\home\site\repository\xxxxxx\xxxxxx\xxxxxx.csproj]
D:\Program Files (x86)\dotnet\sdk.2.109\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.1.  Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.1. [D:\home\site\repository\xxxxxx\UnitTest\UnitTest.csproj]
Failed exitCode=1, command=dotnet restore "D:\home\site\repository\xxxxxx\xxxxxx.sln"
An error has occurred during web site deployment.
\r\nD:\Program Files (x86)\SiteExtensions\Kudu.11226.4297\bin\Scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"    

所以说不支持.net core 3.1

这是一个明显的错误,因为我刚刚更新了它。

但我无法弄清楚是什么导致了我的错误。我无法想象这是 Azure 的抱怨,因为他们确实支持 .net core 3.1 (https://docs.microsoft.com/en-us/azure/azure-functions/functions-versions)。我也无法想象源是内置的 Bitbucket(是吗?)而且 Bitbucket 不支持 .net core 3.1?

编辑 我找到了关于 'Kudu' 这个词的一些信息。它似乎在 Azure 上,负责从(除其他外)GIT 到 Azure 的部署。所以现在我想知道为什么 Kudu 不支持 .net core 3.1

编辑 2: 我列出的框架:

D:\home>dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.1 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.2 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [D:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.16 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.13 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.14 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.2 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]

编辑 3:

难道这个host.json是错的?

{
    "version": "2.0"
}

没读到它必须更改,但也许?

在写另一条评论时找到了原因。据我所知,您正在将源代码推送到 AppService 并让 Kudu 构建应用程序。这不起作用,因为虽然安装了 3.1 运行time,但没有安装 3.1 SDK

如果您 运行 dotnet --list-sdks,您也会看到这一点。您需要在将应用程序推送到 Kudu 之前构建您的应用程序,或者等到 windows 系统上安装了 3.1 SDK。您还可以尝试使用 Linux 应用服务。

https://github.com/Azure/app-service-announcements/issues/217

The SDK deployment will happen once the runtime is globally available.

三个多月过去了,运行时间部署还没有完成。所以我预计 SDK 部署需要更多时间。