MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.28k stars 21.46k forks source link

Error following windows cli tutorial #122341

Closed JakeDriscoll closed 6 months ago

JakeDriscoll commented 6 months ago

Followed the guide, Quickstart: Create a C# function in Azure from the command line for an install on windows and coming up with the following error after running func start:

Microsoft.Azure.WebJobs.Extensions.Http: Could not load file or assembly 'System.Net.Http.Formatting, Version=5.2.8.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.
Value cannot be null. (Parameter 'provider')

Commands run

func init dotnet8Function --worker-runtime dotnet-isolated --target-framework net8.0
cd .\dotnet8Function\
func new --name PostOfficeHealthCheck --template "HTTP trigger" --authlevel "anonymous"
func start

Tool Versions dotnet sdk 8.0.204

Azure Functions Core Tools
Core Tools Version:       4.0.5700 Commit hash: N/A +71cc84964a60bfb07d95839b7c666bd239507bdd (64-bit)
Function Runtime Version: 4.33.2.22572

Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

TPavanBalaji commented 6 months ago

@JakeDriscoll Thanks for your feedback! We will investigate and update as appropriate.

Venkateshdodda-MSFT commented 6 months ago

@JakeDriscoll I have followed the same documentation steps, able to create and run the HTTP trigger function locally and my local environment is running with Function core tools v4.0.5700,.Net v8.0.204.

Also, I see the documentation steps are up to date as well.

This GitHub forum is more inclined towards the documentation feedback, so that we can improve our documentation. If its technical issue, kindly post on Q & A Forum.

We will close this out, but if you feel you need more information, please just let us know.

JakeDriscoll commented 6 months ago

My apologies. My intent was to see if there was a missing step or anything that could/would be added to the docs to improve them so they wouldn't fall into the same pitfall I did.

blayvant commented 5 months ago

@JakeDriscoll I'm running into the same issue. Were you able to resolve it?

MItsutoshiNAKANO commented 5 months ago

@blayvant I uninstalled "Azure Functions Core Tools". Then download it from https://go.microsoft.com/fwlink/?linkid=2174087 and reinstalled it. Then it runs normal.

https://learn.microsoft.com/en-us/answers/questions/1665338/how-to-fix-could-not-load-file-or-assembly-microso

Is this helpful?

blayvant commented 5 months ago

I was able to resolve the issue by clearing nuget cache and re-installing Azure Functions Core Tools thanks to https://github.com/Azure/azure-functions-core-tools/issues/3096