I've been able to get Azure functions written in net core to run. I now have added a reference to "WindowsAzure.Storage" and am now getting loaderexceptions when I use the local test environment ("func host start").
I can not use the default table storage binder as I need to upsert records in different tables.
I use precompiled functions and am developing with VSCode on OSX. I can't find any info if this scenario is supported or not. Is it even possible to get external dependencies working with the 2.0 runtime of Azure functions.
The local SDK/runtime is
- Azure Functions Core Tools (2.0.1-beta.21)
- Function Runtime Version: 2.0.11370.0
My csproj file
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0-beta3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta3" />
<PackageReference Include="WindowsAzure.Storage" Version="8.6.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SearchTwitter\function.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
Part of my function
namespace MyProject.Functions
{
public class SearchFunction
{
public async static Task Run(TimerInfo myTimer, Binder binder, TraceWriter log)
{
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(System.Environment.GetEnvironmentVariable("StorageConnection", EnvironmentVariableTarget.Process));
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
CloudTable searchMetaDataTable = tableClient.GetTableReference("SearchMetaData");
await searchMetaDataTable.CreateIfNotExistsAsync();
}
}
Function.json
{
"bindings": [
{
"type": "timerTrigger",
"direction": "in",
"schedule": "0 */15 * * * *",
"runOnStartup": true,
"name": "myTimer"
}
],
"scriptFile": "../MyProject.Functions.dll",
"entryPoint": "MyProject.Functions.SearchFunction.Run"
}