Azure / azure-functions-vs-build-sdk

MSBuild task for Azure Functions
MIT License
98 stars 65 forks source link

Microsoft.NET.Sdk.Functions 4.1.2 - Fails to run locally with new project. #586

Closed countchivas closed 2 years ago

countchivas commented 2 years ago

Creating a new Azure Functions project with http trigger runs locally with 4.1.1, but upgrading to 4.1.2 produces the following error.

A host error has occurred during startup operation '9961b9b4-2e91-49c8-aa7d-3f87ec5532d3'. [2022-08-30T22:57:28.349Z] System.Private.CoreLib: Could not load file or assembly 'Microsoft.Azure.WebJobs.Extensions.Http, Version=3.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. Value cannot be null. (Parameter 'provider')

Adding Microsoft.Azure.WebJobs.Extensions.Http 3.2.0 does not fix the issue.

Azure Functions Core Tools Core Tools Version: 4.0.3971 Commit hash: d0775d487c93ebd49e9c1166d5c3c01f3c76eaaf (64-bit) Function Runtime Version: 4.0.1.16815

chris-parker-bliss commented 2 years ago

Not sure if this'll help but I was having the exact same issue, and doing the following seems to have resolved it for me:

davidmine commented 2 years ago

Having the same problem, I tried the solution above, but the problem persisted. I was upgrading from version 3.0.13 and thought that the major version change was breaking it for me. Once I downgraded to 4.1.1, the functions started fine.

Oddly enough, I only experienced this when debugging from VS. I never encountered this issue in the CLI (installed through NPM in the node directory) which makes sense because those DLLs are isolated from where the core tools MSI GUI installs itself (somewhere in AppData)

jdluzen commented 2 years ago

Same problem. I had to update the Function Core Tools. The various CLI/npm/VS install options also tripped me up.

mprice-gcmlp commented 2 years ago

We just resolved this by deleting %LOCALAPPDATA%\AzureFunctionsTools\Releases\4.21.0, opening VS 2022 back up, going to Tools -> Options -> Projects and Solutions -> Azure Functions. Clicking Check for Updates and downloading it. Then it magically worked again.

m4m4m4 commented 2 years ago

The following solved the problem for me on Windows, SDK version 4.1.3

winget uninstall Microsoft.AzureFunctionsCoreTools
winget install -e --id Microsoft.AzureFunctionsCoreTools
ramya894 commented 2 years ago

closing the issue as resolved