Attempted to upgrade the Microsoft.NET.Sdk.Functions to 4.5 but it didn't work for me. While it might work for some, this wasn’t feasible in my case, as other environments were running fine, and the issue was only occurring on my machine.
Here’s what worked for me:
%LocalAppData%\AzureFunctionsTools
and restart the VS. Note: It's crucial to have .NET 6.0 installed for this step to work.