skip to Main Content

I have an Azure Function project and I want to run the project with Azure Functions Core Tools v4.x. But Visual Studio is always selecting Azure Functions Core Tools 2.6. With that, I am getting the following error:

You are using an outdated version of the Azure Functions Core Tools.
For more information, please see: https://aka.ms/func-v2-upgrade

I deleted all Azure Functions Core Tools runtimes in %LocalData%/AzureFunctionTools/Releases/. But again when I run the project, Azure Function Tools 2.6 version is getting installed.

How to change this to use the 4.x version?

I am using:

  • Visual Studio 2022
  • Windows 11
  • .NET Core 2.2

Update:

I found this article on the internet. But just adding a new function to the project did not work for me. But when I create a new project, it selects the latest version of Azure Function Core Tools 4.x . I still don’t know how to do this for an existing project.

2

Answers


  1. I tried to reproduce the same issue in my environment with.NET Core 2.2 Azure Functions Project:

    .csproj file:

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFramework>netcoreapp2.1</TargetFramework>
        <AzureFunctionsVersion>v2</AzureFunctionsVersion>
      </PropertyGroup>
      <ItemGroup>
        <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.38" />
      </ItemGroup>
      <ItemGroup>
        <None Update="host.json">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Update="local.settings.json">
          <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
          <CopyToPublishDirectory>Never</CopyToPublishDirectory>
        </None>
      </ItemGroup>
    </Project>
    

    enter image description here

    You can’t migrate the Azure Functions v2 to v4 directly as you cannot move from .NET Core 2.2 to 6 as specified in this MS Doc:

    enter image description here

    Migrated from .NET Core 2.2 to 3.1 Azure Functions Project:

    enter image description here

    Everything of the above practical done on Visual Studio 2019 because this IDE is supported up to .NET Core 3.1 Version of Azure Functions.

    Migrated Azure Function from .NET Core 2.1 to 3.1 Project on Visual Studio 2022 and again migrated to .NET Core 6 v4 version.

    enter image description here

    If the Function/Application code is huge, then you need to change the code compatible to v4 version along with some changes in the configurations are specified in this MS Doc.

    Login or Signup to reply.
  2. In my case, visual studio 2022, was using an older version of functions runtime, despite installing newer versions.

    This came from the following folder:
    C:Users<username>AppDataLocalAzureFunctionsTools

    Even upon deleting the folder contents they were regenerated everytime but only to the older version.

    I had to goto visual studio settings, where I found a way to update to the latest version of the functions tool. There was no notification anywhere else asking me to upgrade.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search