Failed to initialize CoreCLR hresult: 0x80004005

Kim Strasser 1,036 Reputation points
2023-04-28T10:59:35.5666667+00:00

I have created a new local project in VS Code and a new function app in Azure like described in this article: https://learn.microsoft.com/en-us/azure/azure-functions/create-first-function-vs-code-csharp?pivots=programming-language-csharp&tabs=in-process

But I always get this error when I click on Start Debugging:

/Users/name/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/4.0.1/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): error : Metadata generation failed. Exit code: '137' Error: 'Failed to initialize CoreCLR, HRESULT: 0x80004005' [/Users/name/NewAzureFunctions/NewAzureFunctions.csproj]

I have tried to deploy the new local project to Azure but it is not working:

Bildschirmfoto 2023-04-27 um 13.48.27

I clicked on Deploy Anyway but then I get this message: Failed to deploy path that does not exist: /Users/name/NewAzureFunctions/bin/Release/net6.0/publish

My .csproj file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
    <PackageReference Include="PlayFabAllSDK" Version="1.150.230403" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>

Bildschirmfoto 2023-04-28 um 12.55.08

I use Visual Studio Code Version 1.77.3 on a Mac. Why is it not working?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,029 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Kim Strasser 1,036 Reputation points
    2023-04-29T16:20:38.2633333+00:00

    It works now. I just needed to install .NET SDK 5.0.408: https://dotnet.microsoft.com/en-us/download/dotnet/5.0

    I found the answer here: https://github.com/Azure/azure-functions-core-tools/issues/2876

    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.