0

I've opened an issue here at the beginning: https://github.com/Azure/azure-functions-durable-extension/issues/692

Actually, it's not a bug in the durable function but more a msbuild issue.

Looking at the build on a working machine, I have this logs:

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')).

At the very beginning of the build on the working machine I have this line in the logs:

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)

Any idea on how to solve that?

EDIT:

Here is the 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>

and the 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}");
        }
    }
}

I've uninstalled all previous version of Visual Studio, there is only VS 2019 now.

JuChom
  • 5,717
  • 5
  • 45
  • 78

1 Answers1

0

Essentially sometimes you have to include an extra dependency to get msbuild/visual studio to run the post build steps and generate your extensions file.

Add Microsoft.Azure.Webjobs.Script.ExtensionsMetadataGenerator as a dependency to your functions project and it should always (so far) build your publish directory properly.

Please check the similar issue :

https://github.com/Azure/Azure-Functions/issues/928#issuecomment-420679962

Mohit Verma
  • 5,140
  • 2
  • 12
  • 27
  • Thanks, for your reply, I already tried it and the issue is still here. See my updated post. – JuChom Apr 17 '19 at 09:36