I used Azure function core tools to make my function. I'm trying to import Newtonsoft.Json, but I can't get it to work correctly. Here is my basic setup:
function.proj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="11.0.2"/>
</ItemGroup>
function.json:
{
"disabled": false,
"bindings": [
{
"name": "myTimer",
"type": "timerTrigger",
"direction": "in",
"schedule": "0 * * * * *"
}
]
}
run.csx:
using System;
using Newtonsoft.Json;
public static void Run(TimerInfo myTimer, ILogger log)
{
log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");
}
host.json:
{
"version": "2.0"
}
When I run "func host start", it crashes immediately when it hits "using Newtonsoft.Json".
It appears to be monitoring my function.proj file correctly, because every time I save it, it claims that it is restoring my packages.
Am I doing something wrong? How can I get my Nuget package?