Search code examples
c#azure-functionsazure-functions-core-tools

Azure function don't start locally


I have Azure Function and try to start in locally, but after starting command line is show and hide during less than 1 sec. I tried to catch it on screenshot:

enter image description here

it looks like no correct parameters for start.

my local.settings.json:

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
  },
  "ConnectionStrings": {
  }
}

my csproj file is:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <AzureFunctionsVersion>v3</AzureFunctionsVersion>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SendGrid" Version="3.0.2" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.4" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
    <PackageReference Include="SendGrid" Version="9.22.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\Libraries\Tms.Services\Tms.Services.csproj" />
    <ProjectReference Include="..\..\Libraries\Tms.SlackNotificationCore\Tms.SlackNotificationCore.csproj" />
    <ProjectReference Include="..\..\Libraries\Verizon\VerizonApiImplementation\VerizonApiImplementation.csproj" />
  </ItemGroup>
  <ItemGroup>
    <None Update="Files\EmailTemplate\DailyExtremelyHighUsageNotificationTemplate.html">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="Files\EmailTemplate\DailyExtremelyHighUsageNotificationTemplate.txt">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

also, I set "Executable" Launch on Debug property window and full path:

enter image description here

because without it azure function could not start at all locally with error:

--------------------------- Microsoft Visual Studio --------------------------- The debug executable 'C:\Users\OLEG\AppData\Local\AzureFunctionsTools\Releases\3.23.5\cli_x64\func.exe' specified in the '...' debug profile does not exist. --------------------------- OK

Where can I check it?


Solution

  • This is cause of Azure function version tools and references may not downloaded properly.

    Two ways to fix this problem

    Remove the existing installation folder (C:\Users\OLEG\AppData\Local\AzureFunctionsTools\Releases\3.23.5\cli_x64\func.exe)

    And create a new Azure Function app from visual studio. It will download the new azure function tools and references.

    Or

    You can rename your installation path ….\Releases\3.23.5\cli_x64\… into ….\Releases\3.23.5\cli\...

    Refer here for similar issue