Problem in my local paradise: Func CLI doesn't upgrade

Last Friday, I encountered an issue while trying to run my Azure Function locally using VS Code. Despite having installed the Azure Function extension and the Azure Functions Core Tools, I was unable to execute the func start command without encountering an error saying that no functions could be found. 

In this post, I will share the various troubleshooting steps I took, what didn’t work, and how I ultimately resolved the issue. Spoiler alert: everything is now working correctly.

The Problem

My Azure Function is a .NET 8 Isolated HTTP trigger. When I attempted to execute the func start command, it failed to find any functions. A quick look at the documentation, I discovered that version 4 of the Core Tools was required for type Isolated process. However, I had already installed version 4 via the update popup in VS Code.

VS Code tool update

Something was wrong. I tried func --version and it returned 3.x.xx, weird... And this is how I knew there was a problem.

Failed attempts

Following the Azure Functions Core Tools documentation I found that there were multiple methods to install the Core Tools. Because that laptop was on Windows 11, I started by downloading the func-cli-x64.msi installer and run it. It didn't work, the version 3 was still there.

I tried to install the Core Tools v4 using NPM: npm install -g azure-functions-core-tools@4. It didn't work.

I tried to uninstall the version 3 with npm uninstall -g azure-functions-core-tools. I tried using the command palette in VSCode

VS Code uninstall Core Tool

Still nothing was changing anything, the version 3 was still there.

The Solution

What works, was using Chocolatey command choco uninstall azure-functions-core-tools to uninstall the version 3. Some how, it must have been install at the different location or some "config" got lost at some point (it's a developer laptop after all), and the other methods (npm, msi, vscode) couldn't see that version 3 was installed.

After that, I installed the version 4 using NPM npm install -g azure-functions-core-tools@4. And it worked! The func --version returned 4.0.5571 and the func start command found my function.

I wrote this quick post hoping that it can help someone else, as I cannot be the only one with this problem.