Visual Studio Azure Function App 的 2022 和 .net 更新问题

Visual Studio 2022 and .net update issues for Azure Function App

我一直在为我的 Azure Function App 使用 Visual Studio 2019。我最近更新到2022版,然后卸载了2019.

我现在收到以下错误:

 1>CodeaApi -> G:\AVR_Project\Codea App\Codea Azure Function App\bin\Debug\netcoreapp3.1\bin\CodeaApi.dll
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : It was not possible to find any compatible framework version
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : The framework 'Microsoft.NETCore.App', version '3.0.0' (x64) was not found.
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error :   - The following frameworks were found:
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error :       6.0.1 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : 
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : You can resolve the problem by installing the specified framework and/or SDK.
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : 
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : The specified framework can be found at:
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error :   - https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.0.0&arch=x64&rid=win10-x64
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error :
    1>C:\Users\asf\.nuget\packages\microsoft.net.sdk.functions.0.6\build\Microsoft.NET.Sdk.Functions.Build.targets(41,5): error : Metadata generation failed.
    1>Done building project "CodeaApi.csproj" -- FAILED.

我是否需要安装 3.0.1 版才能使其与 Azure Function Apps 兼容?

是的,您可以通过安装 .NET Core 3.1 SDK

来解决这个问题

When targeting Azure Functions 3.0, by default, the .NET Core 3.1 SDK is required on the machine building the project.