ThanhPT
ThanhPT

Reputation: 31

How to call function in .Net Framework to .Net core

I am doing a project that use both .net framework and .net core.

I want to call repository that fetch data in API controller of .net core but i get the following error:

System.TypeLoadException: 'Could not load type 'System.Web.HttpContext' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.'

Pls help me, thank you.

Upvotes: 1

Views: 3696

Answers (1)

Conrad
Conrad

Reputation: 118

You are not in position to call functions in .NET core from .NET framework. Rather, I recomment that for the functions and classes shared between both of your projects, you write them in a library in .NET Standard. This will be accessible from both the .NET framework projects and .NET core projects.

For more information about NET architectural components (.NET standard, core and framework), kindly visit https://learn.microsoft.com/en-us/dotnet/standard/components

Thank you

Upvotes: 5

Related Questions