使用 Azure Functions Core 工具加载 NuGets 时出错 (2.0.1-beta.31)

Error loading NuGets with Azure Functions Core tools (2.0.1-beta.31)

Azure Functions Core Tools (2.0.1-beta.31) Function Runtime Version: 2.0.11888.0

我正在使用 F# 编写 v1 函数。作为部署的一部分,我使用 Paket 引入 NuGets 并将代码构建到预编译程序集中。我已经用了好几个月了。

我认为本地测试在我更新到 2.0.1-beta.31 后停止了 运行。

现在,当我使用 func host start 进行测试时,我看到了这个错误的多个实例:

[7/18/18 9:14:32 PM] Could not load file or assembly 'Octokit, Version=0.27.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
[7/18/18 9:14:32 PM] Could not load file or assembly 'FSharp.Data, Version=2.4.2.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
[7/18/18 9:14:32 PM] Could not load file or assembly 'FSharp.Control.AsyncSeq, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

我认为这与程序集绑定重定向有关,但现在我不这么认为,因为 Octokit 没有(不应该)有任何相关的外部依赖项。

我已经在 Mac 和 Windows 上测试了这个,我在两个平台上都看到了同样的错误。

有两个版本的 Azure Functions 运行时间:

  • v1,它建立在完整的 .NET Framework 之上并且 Windows-only (GA)
  • v2,基于 .NET Standard 2.1 构建并且是跨平台的(预览版)

这些本质上是两个独立的 "branches" 函数。因此,有两个版本的 Azure Functions Core Tools:

  • 1.x,其中 运行 是 v1 函数 运行time
  • 2.x,其中 运行 是 v2 函数 运行time

您安装了 2.x Core Tools 版本并试图在其上运行 运行 v1 功能,这就是您遇到错误的原因。您需要恢复到最新的 1.x 版本的 Azure Functions Core Tools。

回复:一般来说,函数 v1 和 v2,v2 是我们工程工作的重点。出于这个原因,我们建议用户考虑迁移到 v2 或开始新项目。目前没有弃用 v1 的计划,如果我们这样做,v1 将在 v2 正式发布后至少一年内普遍可用(预计在今年秋天的某个时候)。