ASP.NET Core 2.0 Azure Webjobs SDK adding project reference throws exception

2

now that asp.net core 2.0 is here I started to test out the new azure webjobs sdk. Everything works fine but when I Add a project reference (netstandard 2.0 class library) I get this exception.webjobs exception

Stack Trace:

System.MissingMethodException occurred HResult=0x80131513 Message=Method not found: 'System.Collections.Generic.Dictionary2<System.String,System.Object> Microsoft.Extensions.Configuration.IConfigurationBuilder.get_Properties()'. Source=<Cannot evaluate the exception source> StackTrace: at Microsoft.Extensions.Configuration.FileConfigurationExtensions.GetFileProvider(IConfigurationBuilder builder) at Microsoft.Extensions.Configuration.FileConfigurationSource.EnsureDefaults(IConfigurationBuilder builder) at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build(IConfigurationBuilder builder) at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build() at Microsoft.Azure.WebJobs.Host.ConfigurationUtility.BuildConfiguration() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at Microsoft.Azure.WebJobs.Host.ConfigurationUtility.get_Configuration() at Microsoft.Azure.WebJobs.Host.ConfigurationUtility.GetSettingFromConfigOrEnvironment(String settingName) at Microsoft.Azure.WebJobs.JobHostConfiguration..ctor(String dashboardAndStorageConnectionString) at Microsoft.Azure.WebJobs.JobHostConfiguration..ctor() at CommunicationsProcessor.Program.Main(String[] args) in C:\Users\RugerTek\Documents\Projects\facturas\CommunicationsProcessor\Program.cs:line 13

Thanks in advance!

c#
asp.net
azure
azure-webjobssdk
.net-core-2.0

1 Answer

3

I also tested it on my side. But I can't reproduce the issue. Here are the steps what I did.

Step 1, Create a .NET Core 2.0 Console Application. Step 2, Install Microsoft.Azure.WebJobs 3.0.0-beta1-10941 using following command.

Install-Package Microsoft.Azure.WebJobs -Version 3.0.0-beta1-10941 

Step 3, Add 2 classes to the project.

class Program
{
    static void Main(string[] args)
    {
        Environment.SetEnvironmentVariable("AzureWebJobsDashboard", "mystorage-connectionstring");
        Environment.SetEnvironmentVariable("AzureWebJobsStorage", "mystorage-connectionstring");
        var config = new JobHostConfiguration();

        if (config.IsDevelopment)
        {
            config.UseDevelopmentSettings();
        }

        var host = new JobHost(config);
        host.RunAndBlock();
    }
}

public class Functions
{
    public static void ProcessQueueMessage([QueueTrigger("myqueue")] string message, TextWriter log)
    {
        log.WriteLine(message);
    }
}

Step 4, Create a .NET Standard 2 class library named ALibrary. There is a only a simple type in my class library.

public class Class1
{
    public string Property1 { get; set; }
}

Step 5, Add reference to the class library.

enter image description here

Step 6, Build and run my console application(WebJob). I can get the right output from the console window if I add a message to the queue.

enter image description here

Please compare the steps between mine and yours and post the differences if they are.

answered on Stack Overflow Aug 18, 2017 by Amor

User contributions licensed under CC BY-SA 3.0