azure - Azure Functions v2 中的 WebJobsStartup 在定位 netcoreapp2.1 时不起作用

标签 azure .net-core azure-functions

我有一个 Azure Function v2 应用程序,最初的目标是 netcoreapp2.1

然后我有一个 Startup.cs 类,用 [ assembly: WebJobsStartup(typeof(Startup))] 注释来设置 dependency injection ,但它没有在 extensions.json 文件中注册 Startup

这是在构建期间发生的。 Publish has another issue at the moment .

当我将项目文件中的 TargetFramework 更改为 netstandard2.0 时,它成功地将 Startup 添加到 extensions.json:

{
  "extensions":[
    { "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"},
    { "name": "Startup", "typeName":"MyApp.Functions.Startup, MyApp.Functions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}
  ]
}

虽然我没有确切的理由以 netcoreapp2.1 为目标,但我很好奇为什么它不起作用,因为 v2 是 changed to target .Net Core by default .

最佳答案

我已从管理 nuget 包将 Microsoft.NET.SDK.Functions 升级到版本 1.0.26,并且它有效。

enter image description here

关于azure - Azure Functions v2 中的 WebJobsStartup 在定位 netcoreapp2.1 时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53062309/

相关文章:

azure - 将所有数据从一个订阅传输到另一订阅

azure - NServiceBus 是否支持 Azure ServiceBus 的可用区或异地复制?

azure - AKS 连接到 Azure Database for MySQL 服务器时出现问题

c# - .NET Core 中是否弃用了 ApiController

c# - 伪造模拟数据 2 个不同属性的相同值

javascript - Azure Function - js - 运行不正确,但日志中没有错误

azure - 如何获取现有 azure databricks 工作区中安装的集群、作业、库等的总数?

使用 monodevelop 调试 dotnet core 2.0 项目

c# - 异步 ServiceBusTrigger 的优点

python-3.x - 端口 7071 不可用。关闭使用该端口的进程,或使用 --port [-p] 指定另一个端口