I am using .NET 5 and developing Azure Functions. When adding a new Timer Trigger function through Visual Studio it adds a file with this content:
public static class Function1
{
[FunctionName("Function1")]
public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
}
I'm including it as a photo here to highlight that it doesn't compile because the TimerTrigger class doesn't exist.
Intellisense suggests that I add the following using:
using Microsoft.Azure.WebJobs;
But that doesn't make sense, because that belongs to the previous version of Azure Functions. And sure enough, Intellisense detects this and show this error.
So how do I use TimerTrigger in .NET 5?
Maybe because this is relatively new, there seems to be no documentation or popular posts about this yet.
