Recently, I converted an Azure Function that used a C# script (*.csx
) to a pre-complied class library using the Visual Studio Studio Tools for Azure Functions.
UPDATE 2018-01-08
According to a new answer by @theGRS https://stackoverflow.com/a/48156446/621827 this has been resolved.
Previous Answer
Here's what I've found.
dotnet msbuild
uses the Microsoft.NET.Sdk.Functions .NETStandard 1.5
library which if you look at the dependencies on NuGet it doesn't use Microsoft.Azure.WebJobs
But if you use the Visual Studio 2017 msbuild
it will use the .NETFramework 4.6
version of the library which includes Microsoft.Azure.WebJobs
.
My suggestion is to use MSBuild for now. I've written a tutorial on how to do this.
I was having the same issue as well when running dotnet build
, but no longer have this issue after updating Microsoft.NET.Sdk.Functions
from 1.0.2 to 1.0.7.
Update to the latest version of this package in your Nuget package manaager and you should be able to run dotnet build
again.