Search code examples
c#.netazurevisual-studiofunction

Running Azure functions locally gives "No runtime" error after .NET7 upgrade


Recently I wanted to upgrade my Azure functions to use .NET 7. For some reasons, after doing all the required steps, when I want to run any of the functions, I keep getting this error message box telling

There is no Functions runtime available that matches the version project specified by the project

I checked to have the proper settings in the .csproj file:

<PropertyGroup>
    <TargetFramework>net7.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
    <ImplicitUsings>enable</ImplicitUsings>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>

Yes, it is spelled with lowercase v for "v4". I checked to have the hosting bundle for .NET7 installed according to my architecture (64-bit Windows) and I restarted the IIS Service after installation. I tried clean-rebuild, reopen Visual Studio, rebooting my compuer and nothing seems to be working. I also have the .NET 7 SDK installed and I am using Visual Studio 2022. If further info is needed, I will update my question accordingly. Thank you!


Solution

  • I eventually found the solution for my case and I will post it here if anyone else faces it. As mentioned in a comment from this Github issue, I had to go to

    Tools -> Options -> Projects & Solutions -> Azure functions and click on the "Check for updates" button.

    enter image description here

    And then I had to download and install the pending updates.

    enter image description here

    This seems to have solved my issue. Hopefully this solution will help others too.