I have an Azure Function v2 app, that I originally targeted netcoreapp2.1
.
I then have a Startup.cs
class, annotated with [assembly: WebJobsStartup(typeof(Startup))]
to set up dependency injection, but it did not register Startup
in the extensions.json
file.
This is happening during build
. Publish has another issue at the moment.
When I change the TargetFramework
in the project file to netstandard2.0
it successfully adds Startup
to 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"}
]
}
While I do not have exact reasons to target netcoreapp2.1
, I am curious to figure out why it doesn't work, as v2 was changed to target .Net Core by default.
In the Azure portal, browse to your function app. Under Settings, choose Configuration. In the Function runtime settings tab, locate the Runtime version. Note the specific runtime version.
NET to version 6. You can do that by updating to the new shiny Visual Studio 2022 with built-in SDK or downloading it from here: . NET 6.0 SDK. In Visual Studio 2022, Azure Functions Core Tools, necessary for developing Azure Functions, are available by adding the Azure Cloud Tool in the installation process of VS.
Start Azure Functions diagnosticsNavigate to your function app in the Azure portal. Select Diagnose and solve problems to open Azure Functions diagnostics. Choose a category that best describes the issue of your function app by using the keywords in the homepage tile.
I have upgraded the Microsoft.NET.SDK.Functions to version 1.0.26 from manage nuget packages and it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With