No job functions found in Azure Functions project

2020-07-24 04:33发布

问题:

I'm trying to create a Azure Functions project in .NET standard 2.0 because I need to use a .NET standard 2.0 class library in this project.

However when I try to create a simple Azure Functions project and run it locally, I get the following error:

https://imgur.com/iDUrgYB.jpg

As I said before my code is very basic but I'll share it anyway.

My .csproj file:

https://i.imgur.com/z5JiLn4.png

My Queue Trigger:

https://i.imgur.com/HPzU4P4.png

My Program.cs:

https://i.imgur.com/9hMujDV.png

(I'm sorry for the links, I can't post images yet)

回答1:

  1. You don't have to target Function App project to .NET Standard in order to use .NET Standard libraries. You can do that from a project targeting Full Framework (net461).

  2. If you want to target .NET Standard, you need 2.0/Core version (still in preview) of Azure Functions tools to be able to run them. You can install these by running npm install -g azure-functions-core-tools@core and then running func start from your publish folder. Note that this func will be in %APPDATA%\Roaming\npm, not %APPDATA%\Local\Azure.Functions.Cli\1.0.7 as in your example.

  3. If you want to run .NET Standard project from Visual Studio, you need 15.5 version preview, see Improvements to Azure Functions in Visual Studio.

  4. Please remove Program.cs: it's not needed for Functions project.