将 Azure Function 从 3.1 升级到 .Net 5 提供“GenerateFunctionMetadata"无法加载任务 [英] Upgrading Azure Function From 3.1 to .Net 5 Give "GenerateFunctionMetadata" task could not be loaded
问题描述
我正在尝试将 Azure Function 从 3.1 更新到 .Net 5.我正在关注下面的文章https://codetraveler.io/2021/02/12/create-azure-functions-using-net-5/
I'm trying to update Azure Function from 3.1 to .Net 5. I am following the below article https://codetraveler.io/2021/02/12/creating-azure-functions-using-net-5/
我创建了一个新的时间触发函数3.1版并按照上面的文章进行
I created a new Time Triggered Function version 3.1 and followed the above article
完成所有必需的步骤后,rebuild 会出现以下错误
After completing all the required steps, rebuild gives below error
严重性代码描述项目文件行抑制状态错误 MSB4062 GenerateFunctionMetadata";无法加载任务从大会C:Usersschudasam.nugetpackagesmicrosoft.net.sdk.functions3.0.11uild.. ools etcoreapp3.1Microsoft.NET.Sdk.Functions.MSBuild.dll.确认声明正确,即组装并且它的所有依赖项都是可用的,并且该任务包含一个实现的公共类Microsoft.Build.Framework.ITask.XYZ.Functions C:Usersschudasam.nugetpackagesmicrosoft.azure.functions.worker.sdk1.0.1uildMicrosoft.Azure.Functions.Worker.Sdk.targets 38
Severity Code Description Project File Line Suppression State Error MSB4062 The "GenerateFunctionMetadata" task could not be loaded from the assembly C:Usersschudasam.nugetpackagesmicrosoft.net.sdk.functions3.0.11uild.. ools etcoreapp3.1Microsoft.NET.Sdk.Functions.MSBuild.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. XYZ.Functions C:Usersschudasam.nugetpackagesmicrosoft.azure.functions.worker.sdk1.0.1uildMicrosoft.Azure.Functions.Worker.Sdk.targets 38
工具:Visual Studio 2019
编辑
我们推迟升级到 .Net 5.将问题留在这里,因为其他人可能有类似的问题.无法尝试这些建议,希望对其他人有所帮助.感谢大家提出解决方案.请为适合您的解决方案投票
推荐答案
确实像 Tobias 提到的那样,删除 de csproj 中的以下行解决了错误.
Indeed like Tobias was mentioning, removing below line in de csproj solved the error.
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.9" />
这篇关于将 Azure Function 从 3.1 升级到 .Net 5 提供“GenerateFunctionMetadata"无法加载任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!