💡 Presently sponsored by: ScriptRunner
Webinar: Azure administration made easy with powershell!
I have a lot of Azure Functions. Most of them are running on v2 with support for .NET Core 2.2 and netstandard2.0.
During the upgrade process of my projects, I stumbled onto this several times across different projects:
Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type ILogger.
The full message:
[2019-12-17 8:10:32 PM] Error indexing method 'ControlApp' [2019-12-17 8:10:32 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'ControlApp'. 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.). [2019-12-17 8:10:32 PM] Function 'ControlApp' failed indexing and will be disabled.
While I knew my NuGets were up to date, and I had verified that I was targeting the correct versions of the same, it still didn't work.
After fiddling around for a bit, I noticed that after upgrading my Azure Function project, the .csproj was still set to the v2 of the functions. 🤦♂️🤦♂️🤦♂️
<PropertyGroup> <TargetFramework>netcoreapp3.1</TargetFramework> <AzureFunctionsVersion>v3</AzureFunctionsVersion> </PropertyGroup>
For info, the NuGet version of the Azure Function SDK I'm referencing right now is:
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.2" />
Voila, that did the trick for me and my Function Apps are running both locally and in the cloud successfully. Phew.
To re-iterate my findings; these were the key factors across all my Function projects:
- Ensure that the
Microsoft.Net.Sdk.FunctionsNuGet is at least version
There's others with similar issues, solved in other ways. This is not a one solution to rule them all, but it appears that across quite a few of the projects I have, this indeed was a culprit - I hope it can help someone else.