Reputation: 105
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://i.sstatic.net/AsG4X.png
As I said before my code is very basic but I'll share it anyway.
My .csproj file:
https://i.sstatic.net/IQBDK.png
My Queue Trigger:
https://i.sstatic.net/4OKC0.png
My Program.cs:
https://i.sstatic.net/xTSSj.png
(I'm sorry for the links, I can't post images yet)
Upvotes: 2
Views: 1185
Reputation: 35124
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 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.
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.
Upvotes: 4