Reputation: 1094
I'm trying to run an Azure Function. After upgrading to .Net 6, debugging it locally with an updated version of Visual Studio 2022 gives me the following exception:
A host error has occurred during startup operation 'dca54039-23ee-4ec2-ad9d-9deafe1b2869'. [2022-09-08T07:07:05.464Z] Microsoft.Extensions.Configuration.Binder: Cannot create instance of type 'NuGet.Versioning.VersionRange' because it is missing a public parameterless constructor.
My co-workers do not get this error and it works great in production. The big difference we found was that they have a Core Tools Version that differs from mine.
I believe the problem lies here, but besides trying to upgrade I also tried other things:
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
Adding the verbose flag does not get me any further and outputs the following:
Since then I've been trying to upgrade the Tools version. But here's the thing: even though func --version tells me I have 4.0.4736, the debug window still says 4.0.3971. I tried the following things:
npm i -g azure-functions-core-tools@4
in the Package Manager Console.PS C:\Windows\system32> npm i -g azure-functions-core-tools@4 --unsafe-perm true
changed 51 packages, and audited 52 packages in 18s found 0 vulnerabilities
PS C:\Windows\system32> npm i -g [email protected] --unsafe-perm true
changed 51 packages, and audited 52 packages in 26s found 0 vulnerabilities
PS C:\Windows\system32> func --version 4.0.4736
Nothing seems to help.
Upvotes: 5
Views: 5843
Reputation: 1191
For Linux Users:
This could resolve your issue:
Uninstall:
npm uninstall -g azure-functions-core-tools
ReInstall:
npm install -g azure-functions-core-tools
Upvotes: 1
Reputation: 1
This worked for me:
C:\Users\***\AppData\Local\AzureFunctionsTools
temp
and %temp%
App started running for me and the below error got resolved:
A host error has occurred during startup operation '8bd9dcec-3c37-4ecf-9db9-894534073cfd'.
[2022-11-15T07:08:40.813Z] 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.
Upvotes: -1
Reputation: 1094
The solution was:
As soon as I had my co-worker review this question (to make sure I didn't post any vulnerabilities) he said "Oh, that other co-worker found a solution, you should delete C:\Users\***\AppData\Local\AzureFunctionsTools and you're good to go"
So I did.
And it works right away.
Upvotes: 10