Azure function - Issue in referencing custom c# class library project

2
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging; //Nuget package
using MyComp.MyLib.Contracts.Configuration;  // Custom namespace after adding reference of my custom custom class library

namespace FunctionApp1123
 {
   public static class Function1
   {
      [FunctionName("Function1")]
      public static void Run([QueueTrigger("myQNamec", Connection = "connstring")]string myQueueItem, ILogger log)
        {
          var appConfig = new ApplicationConfig(); // custom class available on  above referred custom "**MyComp.MyLib.Contracts.Configuration**" name
           log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");
        }
   }
}

Error received: [2/3/2020 4:46:17 PM] Executed 'Function1' (Failed, Id=93d4305e-d2de-426c-9922-f0320888cddb) [2/3/2020 4:46:17 PM] System.Private.CoreLib: Exception while executing function: Function1. FunctionApp1123: Could not load file or assembly 'MyComp.MyLib.Contracts.Configuration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'MyComp.MyLib.Contracts.Configuration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

My custom c# class library "MyComp.MyLib.Contracts.Configuration" has been consumed by other "non Azure function" project without issues but can't able to consume it in Azure function project. Is it possible to refer custom class library in azure function project using visual studio? if yes, what Im missing?

Note: In Azure function can able refer & consume packages from Nuget but can't able to consume my custom class library by adding project reference in visual studio.

azure-functions
azure-functions-runtime
asked on Stack Overflow Feb 3, 2020 by 191180rk

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0