我在一开始就在这里打开了一个问题:https ://github.com/Azure/azure-functions-durable-extension/issues/692
实际上,这不是持久功能中的错误,而更多是 msbuild 问题。
查看工作机器上的构建,我有以下日志:
10:25:32.475 1:7>Target "_GenerateFunctionsExtensionsMetadataPostBuild: (TargetId:231)" in file "C:\Users\MyUser\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets" from project "C:\MyProject\MyFunctions\E1.Functions.csproj" (entry point):
Using "GenerateFunctionsExtensionsMetadata" task from assembly "C:\Users\MyUser\.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\..\tools\netstandard2.0\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.dll".
Task "GenerateFunctionsExtensionsMetadata" (TaskId:137)
Task Parameter:SourcePath=C:\MyProject\MyFunctions\bin\Release\netcoreapp2.2\bin (TaskId:137)
Task Parameter:OutputPath=C:\MyProject\MyFunctions\bin\Release\netcoreapp2.2\bin (TaskId:137)
Done executing task "GenerateFunctionsExtensionsMetadata". (TaskId:137)
Task "Move" skipped, due to false condition; ($(_IsFunctionsSdkBuild) == 'true' AND Exists('$(TargetDir)extensions.json')) was evaluated as (true == 'true' AND Exists('C:\MyProject\MyFunctions\bin\Release\netcoreapp2.2\extensions.json')).
在工作机器上构建的最开始,我在日志中有这一行:
Property reassignment: $(_FunctionsExtensionsDir)="C:\MyProject\MyFunctions\bin\Release\netcoreapp2.2\bin" (previous value: "C:\MyProject\MyFunctions\bin\Release\netcoreapp2.2")
at C:\Users\MyUser.nuget\packages\microsoft.azure.webjobs.script.extensionsmetadatagenerator\1.0.2\build\Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets (11,5)
关于如何解决这个问题的任何想法?
编辑:
这是csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.8.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.26" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
和 Function1.cs
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
namespace FunctionApp1
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
[OrchestrationClient] DurableOrchestrationClient starter,
ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
}
我已经卸载了所有以前版本的 Visual Studio,现在只有 VS 2019。