Buddhika Chathuranga
Buddhika Chathuranga

Reputation: 1468

Visual Studio detect the old Azure Functions core tools version

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:

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.

Upvotes: 2

Views: 5806

Answers (2)

Gopal Krishnan
Gopal Krishnan

Reputation: 1126

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>\AppData\Local\AzureFunctionsTools

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

Upvotes: 5

anon
anon

Reputation:

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.

Upvotes: 0

Related Questions