azure-functions-core-tools: Dotnet 6.0 Azure function v4 build error - Visual Studio for Mac
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>
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 29
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:
hope this helps
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
Context & Problem I installed .NET 7.0 RC2 (
.NET 7.0.100-rc.2.22477.23
) recently. And I got this error, when building my Azure Functions project:Solution johnkors wrote (2021):
Due to timing of .NET 7.0 just coming out, I didn’t expect that reinstalling .NET 5.0 would help. But this worked:
.NET 5.0 SDK (v5.0.408) - macOS x64 Installer! - GUI
Weird!
Had same issue, reinstalling SDK v5 solved it.
Same issue, Mac OS 13.2.1 (22D68), using Visual Studio Code and command line (dotnet build and func start). I have up to date 6.0 and 7.0 SDKs and runtime installed. Installing .NET dotnet-sdk-5.0.408-osx-x64 solved the issue.
Same error. Started after update applied to VS Mac (v17.5 build 1802). Updated DotNet 6 & 7, but no help. Installed v5 SDK and now have a project that builds again (project is targeted at v6).
Installing dotnet 5 also worked for me(to run a dotnet 6 isolated v4 azure function)
@toklive Brill. However I haven’t been able to get the debugger to attach in VSCode, so I’m unable to hit any breakpoints in my HttpTrigger function - I am using…
Debugger attaches fine on a console app though so seems that it’s just a problem for Function apps then. For now I’m not sure how to fix this issue but may open it up in a new ticket.
Edit: So I got it to work finally, not really sure what I did to get it to fix - closed vscode, cleaned project, started new function project from scratch and all of a sudden ‘Attach to NET Funcions’ worked.