问题
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:
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
).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 runningfunc start
from yourpublish
folder. Note that thisfunc
will be in%APPDATA%\Roaming\npm
, not%APPDATA%\Local\Azure.Functions.Cli\1.0.7
as in your example.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.
Please remove
Program.cs
: it's not needed for Functions project.
来源:https://stackoverflow.com/questions/47534482/no-job-functions-found-in-azure-functions-project-net-standard-2-0-local