Aparna Gadgil
Aparna Gadgil

Reputation: 468

Azure Functions - Could not load file or assembly ''AzureFunctions.Autofac.Shared'

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 -

  1. Uninstall "AzureFunctions.Autofac" NuGet packet and reinstalled it.
  2. Restarted VS even my machine
  3. Made sure I have Azure storage emulator and Azure CLI installed.
  4. Checked all "AzureFunctions.Autofac" NuGet packages are loaded correctly in project.
  5. Tried to Google it but couldn't find a concrete solution.

What could be wrong here and how to debug this issue?

Thanks!

Upvotes: 0

Views: 915

Answers (3)

SanjayD
SanjayD

Reputation: 166

Make sure this is not checked.

Make sure this is not checked.

Upvotes: 0

user1534087
user1534087

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

Ketan
Ketan

Reputation: 1550

I tried with version 3.0.6 as well and it worked. Below are some screenshots from my solution for the reference :

enter image description here enter image description here

public class DIConfig
    {
        public DIConfig(string functionName)
        {
            DependencyInjection.Initialize(builder =>
            {
                builder.RegisterType<NaiveInvestementAllocator>().As<IInvestementAllocator>(); // Naive

            }, functionName);
        }
    }

enter image description here

Also make sure you have all the required dependency mentioned in the Nuget Document

enter image description here

Upvotes: 2

Related Questions