Could not load file or assembly 'System.Data.Entity 4.0.0.0 in azure function referencing a class library

0

Getting this error:

System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified. Source=... StackTrace: at ....

I create an azure function referencing a class library.

I checked on the class library, System.Data.Entity is being referenced. But when I run the azure function, I get this error.

What might be wrong here?

The Azure function is on .Net Core 3.1. The referenced class library (as a project so I can debug it) is on .Net Framework 4.7.2

Is a class library of .net Framework 4.7.2 supported when referenced on .net Core 3.1 (why its not loading System.Data.Entity)?

c#
.net-core
azure-functions
asked on Stack Overflow Aug 11, 2020 by Alexander • edited Aug 11, 2020 by Alexander

1 Answer

0

From this post we can know:

.NET Core doesn't support inclusion of .NET Framework libraries. Period. However, .NET Core supports .NET Standard, and since .NET Framework also implements .NET Standard, Microsoft made a special exception in the compiler to allow you include .NET Framework libraries, with the caveat that they may not actually function at all or totally. You get a warning to this effect when you include a .NET Framework library in a .NET Core project, and it's on you to ensure that the library works correctly end-to-end.

Because .NET Core supports .NET Standard library, you can use the package of .NET Standard. This post is similar to your problem, his solution may inspire you.

answered on Stack Overflow Aug 11, 2020 by Frank Gong

User contributions licensed under CC BY-SA 3.0