0

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!

2
  • Can you try downgrading the version of "AzureFunctions.Autofac" to 3.0.5. Make sure you don't have multiple version of same assembly in your project.
    – Ketan
    Commented Feb 25, 2019 at 9:10
  • I am already using version 3.0.6 version and using .Net Core 2.2. And I am still facing the same issue. I also have single version of the assembly. Commented Feb 25, 2019 at 15:40

3 Answers 3

2

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

2
  • Thanks for your answer! I am already using version 3.0.6 version and using .Net Core 2.2. And I am still facing the same issue. Do you have any further idea about this? Commented Feb 25, 2019 at 15:39
  • @AparnaGadgil Check my answer above, that might help.
    – SanjayD
    Commented Apr 25, 2019 at 17:09
2

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.

0

Make sure this is not checked.

Make sure this is not checked.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.