我在一开始就在这里发布了一个问题: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。
答案 0 :(得分:0)
本质上有时,您必须包括一个额外的依赖项才能使msbuild / visual studio运行后构建步骤并生成扩展文件。
将Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator添加为函数项目的依赖项,并且它应该始终(到目前为止)正确地构建发布目录。
请检查类似的问题:
https://github.com/Azure/Azure-Functions/issues/928#issuecomment-420679962