Visual Studio 检测到旧的 Azure Functions 核心工具版本。

huangapple go评论66阅读模式
英文:

Visual Studio detect the old Azure Functions core tools version

问题

我有一个Azure函数项目,我想使用Azure Functions Core Tools v4.x运行项目。但是Visual Studio始终选择Azure Functions Core Tools 2.6。由此,我收到以下错误消息:

您正在使用过时的Azure Functions Core Tools版本。
有关更多信息,请参见:https://aka.ms/func-v2-upgrade

我在%LocalData%/AzureFunctionTools/Releases/中删除了所有Azure Functions Core Tools运行时。但当我再次运行项目时,安装的是Azure Function Tools 2.6版本。

如何更改以使用4.x版本?

我正在使用:

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

更新:

我在互联网上找到了这篇文章。但仅向项目添加一个新函数对我来说不起作用。但当我创建一个新项目时,它选择了最新版本的Azure Function Core Tools 4.x。我仍然不知道如何在现有项目中实现这一点。

英文:

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.

答案1

得分: 2

在我的情况下,Visual Studio 2022 尽管安装了更新版本,仍在使用较旧版本的函数运行时。这是因为它来自以下文件夹:
C:\Users<username>\AppData\Local\AzureFunctionsTools

即使删除了文件夹中的内容,它们每次都会重新生成,但仍然是旧版本。

我不得不前往Visual Studio设置,那里我找到了升级到最新版本的函数工具的方法。没有在其他任何地方通知我要升级。

英文:

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&lt;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.

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

答案2

得分: 0

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

.csproj文件

&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
  &lt;PropertyGroup&gt;
    &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
    &lt;AzureFunctionsVersion&gt;v2&lt;/AzureFunctionsVersion&gt;
  &lt;/PropertyGroup&gt;
  &lt;ItemGroup&gt;
    &lt;PackageReference Include=&quot;Microsoft.NET.Sdk.Functions&quot; Version=&quot;1.0.38&quot; /&gt;
  &lt;/ItemGroup&gt;
  &lt;ItemGroup&gt;
    &lt;None Update=&quot;host.json&quot;&gt;
      &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
    &lt;/None&gt;
    &lt;None Update=&quot;local.settings.json&quot;&gt;
      &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;CopyToPublishDirectory&gt;Never&lt;/CopyToPublishDirectory&gt;
    &lt;/None&gt;
  &lt;/ItemGroup&gt;
&lt;/Project&gt;

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

你不能直接将Azure Functions v2迁移到v4,因为根据这个MS文档的规定,你不能从.NET Core 2.2迁移到6。

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

从.NET Core 2.2迁移到3.1 Azure Functions项目:

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

上述的所有操作都是在Visual Studio 2019上完成的,因为这个IDE支持Azure Functions的.NET Core 3.1版本。

从.NET Core 2.1迁移到3.1项目,然后再迁移到.NET Core 6 v4版本的Azure Function。

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

如果函数/应用程序代码很大,那么你需要将代码兼容到v4版本,同时还需要按照这个MS文档中指定的配置进行一些更改。

英文:

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

.csproj file:

&lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&gt;
  &lt;PropertyGroup&gt;
    &lt;TargetFramework&gt;netcoreapp2.1&lt;/TargetFramework&gt;
    &lt;AzureFunctionsVersion&gt;v2&lt;/AzureFunctionsVersion&gt;
  &lt;/PropertyGroup&gt;
  &lt;ItemGroup&gt;
    &lt;PackageReference Include=&quot;Microsoft.NET.Sdk.Functions&quot; Version=&quot;1.0.38&quot; /&gt;
  &lt;/ItemGroup&gt;
  &lt;ItemGroup&gt;
    &lt;None Update=&quot;host.json&quot;&gt;
      &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
    &lt;/None&gt;
    &lt;None Update=&quot;local.settings.json&quot;&gt;
      &lt;CopyToOutputDirectory&gt;PreserveNewest&lt;/CopyToOutputDirectory&gt;
      &lt;CopyToPublishDirectory&gt;Never&lt;/CopyToPublishDirectory&gt;
    &lt;/None&gt;
  &lt;/ItemGroup&gt;
&lt;/Project&gt;

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

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:

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

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

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

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.

Visual Studio 检测到旧的 Azure Functions 核心工具版本。

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.

huangapple
  • 本文由 发表于 2023年3月7日 16:30:27
  • 转载请务必保留本文链接:https://go.coder-hub.com/75659559.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定