Microsoft.Extensions.Caching.Abstractions assembly not found: System.IO.FileNotFoundException

The concept of loading a file or assembly is unclear to me. My .Net Standard project utilizes a nuget package and is invoked from a .Net Framework ASP.Net Web project.

Question:

My .Net Standard project employs the nuget package

Microsoft.Extensions.Caching.Memory

. It is invoked by a .Net Framework ASP.Net Web project. However, upon running the code that refers to this nuget package, an error occurs.

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Caching.Abstractions, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'

I attempted to include the

Microsoft.Extensions.Caching.Abstractions

nuget package in my .Net Standard project, but it did not provide a solution. Additionally, I added the same package to my .Net Framework project, but it also did not resolve the issue.


  true
    true

Is there a solution to this issue? Despite no other projects making use of

Microsoft.Extensions.Caching.Abstractions

, I am unable to understand why it cannot locate the correct version.


Solution 1:

Incorporate the

Microsoft.Extensions.Caching.Memory

package into your .NET Framework project.

This approach enables building using the .NET Framework, similar to the previous answer, without cluttering your .NET Standard project or mandating knowledge of the specific .NET Framework version it must support.


Solution 2:


By including other framework bindings, I resolved the issue with the .Net Standard dll. The .Net Standard project was being called by the 4.6.2 version of .Net Framework, which I could not update. While upgrading to 4.7.* may have addressed the problem, it was not a feasible option for me. Despite trying the solutions mentioned earlier, none of them worked and the .dll files for
nuget packages
could not be loaded due to an unknown reason.

I made modifications to the following aspects of my .Net Standard project:

netstandard2.0

to:

netstandard2.0;net462;net47

By using this approach, you can ensure that your project is compiled against all the required frameworks for building.

Frequently Asked Questions

Posted in Uncategorized