Reputation: 468
I have Azure Functions project and I am using Autofac dll for DI in Azure functions. While trying to run the function using VS 2017 (community), it throws an exception -
System.IO.FileNotFoundException: 'Could not load file or assembly 'AzureFunctions.Autofac.Shared, Version=3.0.6.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.'
Things that I have tried to resolve the issue -
What could be wrong here and how to debug this issue?
Thanks!
Upvotes: 0
Views: 915
Reputation: 21
I resolved this issue. My Visual Studio exception settings were modified (some earlier issue I was attempting to resolve).
The exception settings needed to be RESET. It seems that the file not found it being thrown regardless, and the emulator will not run once the exception has been captured by the IDE.
Upvotes: 2
Reputation: 1550
I tried with version 3.0.6 as well and it worked. Below are some screenshots from my solution for the reference :
public class DIConfig
{
public DIConfig(string functionName)
{
DependencyInjection.Initialize(builder =>
{
builder.RegisterType<NaiveInvestementAllocator>().As<IInvestementAllocator>(); // Naive
}, functionName);
}
}
Also make sure you have all the required dependency mentioned in the Nuget Document
Upvotes: 2