I am running Azure function with a Http trigger using .NET Core 3.1 in Visual Studio 2019 Version 16.5.0 Preview 1 and I am getting the following errors:
The 'HttpTriggerCSharp' function is in error: Unable to load one or more of the requested types. [12/25/2019 9:32:30 PM]
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. [12/25/2019 9:32:30 PM]
Microsoft.Azure.WebJobs.Host: Error indexing method 'HttpTriggerCSharp'. Microsoft.Azure.WebJobs.Host: cannot bind parameter 'log' to type ILogger. Make sure the parameter type is supported by the binding. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
The error appears when I installed the nuget package for the Microsoft.EntityFrameworkCore.SqlServer.
Any idea how to fix this?
It turned out I was running v2 of the Azure Function runtime and when I changed it to v3 in the FunctionApp1.csproj file it started to work.
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
Assuming Solution 1.
Install latest .NET Core SDK
Assuming Solution 2.
Delete the bin/ and obj/ folders and rebuild the solution.
Assuming Solution 3.
unistall installed package and reinstall
dotnet add package Microsoft.EntityFrameworkCore.SqlServer --version 3.1.0
.NET Core 2.0 and later, restore is done automatically with dotnet build and dotnet run, but do it manually some time helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With