question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dotnet 6.0 Azure function v4 build error - Visual Studio for Mac

See original GitHub issue

Build Error

/Users/user2/.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'
Done building target "_GenerateFunctionsExtensionsMetadataPostBuild" in project "testfunc.csproj" -- FAILED.

Done building project "testfunc.csproj" -- FAILED.

Build FAILED.

/Users/user2/.nuget/packages/microsoft.azure.webjobs.script.extensionsmetadatagenerator/4.0.1/build/Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator.targets(37,5): warning : Failed to initialize CoreCLR, HRESULT: 0x80004005
/Users/user2/.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'
   1 Warning(s)
   1 Error(s)
func version
4.0.3971
Visual Studio Enterprise 2022 for Mac Preview
Version 17.0 Preview (17.0 build 5186)

Azure function .csProj config

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:29

github_iconTop GitHub Comments

10reactions
andrew-bensoncommented, Dec 16, 2021

Hi there, it seems a .NET 6 install breaks your Function app builds from what I can tell by reading this useful thread on it: https://issueexplorer.com/issue/dotnet/installer/11951. They’re talking about reinstalling .NET 5. I also got this issue but was able to get around it another way by doing some clean up with my SDK and Runtimes currently installed.

I’d recommend downloading the .net uninstaller from here: https://github.com/dotnet/cli-lab/releases

Once it’s running use the following command to see what you currently have installed, as a bonus it will also tell you which SDKs and runtimes are being used by Visual Studio - don’t remove these. ./dotnet-core-uninstall list

I decided on what to remove by using dotnet sdk check and removed anything that said there’s an update available (as long as that update was already in the list).

Then use the command line to delete your sdk --sdk or runtime --runtime e.g. sudo ./dotnet-core-uninstall remove 5.0.401 --sdk

Here’s what my current SDK/Runtime setup in case you want to copy mine:

andrewbenson@Andrews-MacBook-Pro-2 ~ % dotnet sdk check
.NET SDKs:
Version      Status     
------------------------
3.1.416      Up to date.
5.0.404      Up to date.
6.0.101      Up to date.

.NET Runtimes:
Name                          Version      Status     
------------------------------------------------------
Microsoft.AspNetCore.App      3.1.22       Up to date.
Microsoft.NETCore.App         3.1.22       Up to date.
Microsoft.AspNetCore.App      5.0.13       Up to date.
Microsoft.NETCore.App         5.0.13       Up to date.
Microsoft.AspNetCore.App      6.0.1        Up to date.
Microsoft.NETCore.App         6.0.1        Up to date.

hope this helps

7reactions
johnnybegoodcommented, Feb 21, 2022

I was able to fix it with the uninstaller, but after a visual studio (for Mac) update it broke again. Uninstalling doesn’t seem to do the trick anymore.

Reinstalling .NET 5 SDK does resolve the issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Azure Functions & Visual Studio for Mac
A detailed walkthrough of working with Azure Functions in Visual Studio for Mac.
Read more >
Azure function dotnet-isolated v4
provided via the Azure Functions Core Tools. So my error is: Microsoft.Azure.WebJobs.Script: WorkerConfig for runtime: dotnet-isolated not ...
Read more >
Things I Learned #19: MacOS, Dotnet, and Azure Functions
A local, non-Docker build was occurring, so I immediately started looking at Rider to see if I had something misconfigured. The exception being ......
Read more >
How to Change an Azure Function Written in .NET from In ...
The first is going to walk through creating a new Azure Function and ... Pressing F5 or clicking the Run button in Visual...
Read more >
How to run Azure Functions locally on VS Code using ...
Hi there,. I've been trying to run my Azure Functions locally for a lot longer than I'd like to admit and now I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found