【Azure Function】在VS Code中创建Function项目遇见 No .NET worker runtimes found

问题描述

VS Code中,已经安装了Azure Function插件,在创建C# Function时候遇见 No .NET worker runtimes found. 如下图:

 

问题解答

最开始看见这个错误,还真的以为是自己的 Function runtime 没有安装,于是在 VS Code 的Terminal窗口执行 func -version, 和 dotnet --version, 都能得到正确返回信息。

#查看func version

func -version

#查看dotnet version

dotnet --version

面对这样的情况,毫无头绪,那里的问题呢? 把VS Code关了又开,开了再关,还改为Run as Administrator模式,都没能解决!

寻求最强网络的帮助,在Google帮助中,找到了在Github的同样的问题:

Internal error: No .NET worker runtimes found when creating C# functions project #3662 : https://github.com/microsoft/vscode-azurefunctions/issues/3662

alexweininger commented on May 13, 2023

The error Internal error: No .NET worker runtimes found. actually has nothing to do with local installations of .NET. I can reproduce this if I configure the "Azure Functions: Project Runtime" setting to ~3 in my global VS Code settings. It works if I leave the setting as the default value (blank) or set it to ~4.

他提到在VS Code的设置中,如果把Function Runtime设置为 ~3, 而我们安装的Function Runtime 为 4.0,就会出现(Internal error:No .NET worker runtimes found)这样的错误。

根据提示,打开Settings --> 查看Function Runtime,被设置为 ~3。根据提示,修改为 ~4 之后,问题解决。

这里被设置为~3 的原因应该是历史遗留问题,在把Function Runtime升级到v3后,没有关注到VS Code中的设置问题。

 

参考资料

Internal error: No .NET worker runtimes found when creating C# functions project : https://github.com/microsoft/vscode-azurefunctions/issues/3662

在 Azure 中使用 Visual Studio Code 创建 C# 函数 : https://docs.azure.cn/zh-cn/azure-functions/create-first-function-vs-code-csharp

 

posted @   路边两盏灯  阅读(20)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2023-05-06 【Azure 应用服务】Azure JS Function 异步方法中执行SQL查询后,Callback函数中日志无法输出问题
2022-05-06 【Azure Developer】使用 Powershell az account get-access-token 命令获取Access Token (使用用户名+密码)
点击右上角即可分享
微信分享提示