Azure Function App忽略依赖项

Azure Function App忽略依赖项

问题描述:

我有一个连接到数据库的Azure函数,但是失败,并显示以下消息-

I have an Azure Function that connects to a database, but it's failing with the following message -

找不到类型或名称空间名称'Npgsql'(您是否缺少using指令或程序集引用?)

The type or namespace name 'Npgsql' could not be found (are you missing a using directive or an assembly reference?)

project.json 中,我有以下声明-

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Npgsql": "3.2.2",
        "System.Runtime.Serialization.Formatters": "4.3.0"
      }
    }
  }
}

奇怪的是,我在另一个Function App(较低环境)上运行的功能完全相同(从Octopus部署).

The strange thing is, I have the exact same Function (deployed from Octopus) running on another Function App (a lower environment) without issue.

有人能够解释为什么我的依赖关系在一个功能应用程序中被忽略而在另一个功能应用程序中却未被忽略吗?

Is anyone able to explain why my dependancies being ignored in one Function App but not the other?

所以这似乎是由于Function App的部署方式而发生的.我使用的是章鱼,通过部署Azure Web应用程序"过程步骤进行部署,似乎令人遗憾的是删除了旧文件,并复制了更新后的文件.

So this seems that this is happening due to the way that the Function App is deployed. I'm using Octopus, deploying via the "Deploy an Azure Web App" process step, and it seems that all that's happeing is the old files are being deleted, and the updated files copied across.

据我所知,问题是 project.json 中的依赖关系无法解决,除非您通过门户网站编辑文件然后保存.

The trouble is, as far as I can tell, the dependancies in project.json are not resolved unless you edit the file via the Portal and then save it.

我不确定这是否可以归类为Octopus或Azure(或只是真正的懒惰实现Function Apps)中的错误,但这非常令人沮丧.从本质上讲,它不可能远程部署包含对 function.json 所做的更改的Function App.

I'm not sure if this can be classed as a bug in either Octopus or Azure (or just really lazy implementation Function Apps), but it's very frustrating. Essentially it makes remote deployment of a Function App that includes changes to function.json impossible.