Azure 函数发布未在 extensions.json 中创建 Startup class 条目
Azure function Publish not creating Startup class entry in extensions.json
我们正在为我们的新产品开发一组 Azure 函数。我们正在按照以下文章中提到的策略为我们的项目使用依赖注入
https://blog.wille-zone.de/post/azure-functions-dependency-injection/
并在 Startup.cs
中注册了扩展
这在本地开发环境中运行良好。但是,当我们尝试将其发布为 azure 时,azure 函数运行时未检测到注入的依赖项。我们在以下 flow.com post
的 sctak 中发现了类似的问题
我们根据他们在已接受答案中的建议进行了更改。按照这个
"In C# the SDK 1.0.19 looks at build time for classes attributed with WebJobsStartup assembly attribute in the current function project or any dependency (ProjectReference or PackageReference) of the current project, and generates the corresponding extensions.json file."
但是我们 运行 遇到了 st运行ge 问题,当我们进行发布构建时,启动 class 条目是在 extensions.json
{
"extensions":[
{ "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"},
{ "name": "Startup", "typeName":"AAA.BBBB.Functions.Startup, AAA.BBB.Functions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"}
]
}
然而,当我们尝试发布时,启动 class 条目并未在 extensions.json
中创建
{
"extensions":[
{ "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
]
}
我们很纳闷,不知道是什么问题
看起来这是一个已知问题。有关更多详细信息,请参阅 Github URL -
https://github.com/Azure/Azure-Functions/issues/972#issuecomment-426708865
目前在解决方法中进行
我们正在为我们的新产品开发一组 Azure 函数。我们正在按照以下文章中提到的策略为我们的项目使用依赖注入
https://blog.wille-zone.de/post/azure-functions-dependency-injection/
并在 Startup.cs
中注册了扩展这在本地开发环境中运行良好。但是,当我们尝试将其发布为 azure 时,azure 函数运行时未检测到注入的依赖项。我们在以下 flow.com post
的 sctak 中发现了类似的问题我们根据他们在已接受答案中的建议进行了更改。按照这个
"In C# the SDK 1.0.19 looks at build time for classes attributed with WebJobsStartup assembly attribute in the current function project or any dependency (ProjectReference or PackageReference) of the current project, and generates the corresponding extensions.json file."
但是我们 运行 遇到了 st运行ge 问题,当我们进行发布构建时,启动 class 条目是在 extensions.json
{ "extensions":[ { "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}, { "name": "Startup", "typeName":"AAA.BBBB.Functions.Startup, AAA.BBB.Functions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"} ] }
然而,当我们尝试发布时,启动 class 条目并未在 extensions.json
中创建{ "extensions":[ { "name": "AzureStorage", "typeName":"Microsoft.Azure.WebJobs.Extensions.Storage.AzureStorageWebJobsStartup, Microsoft.Azure.WebJobs.Extensions.Storage, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"} ] }
我们很纳闷,不知道是什么问题
看起来这是一个已知问题。有关更多详细信息,请参阅 Github URL -
https://github.com/Azure/Azure-Functions/issues/972#issuecomment-426708865
目前在解决方法中进行