1

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.

jazb
  • 5,498
  • 6
  • 37
  • 44
ThanhPT
  • 31
  • 1
  • 5

1 Answers1

5

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

Conrad
  • 118
  • 11
  • Not necessarily, it can be not only be a desktop project but also be a console app, website, web API, Class Library, e.t.c – Conrad Oct 31 '18 at 05:45
  • Kindly visit [http://www.infocodify.com/csharp/csharp_applications] for a full list of applications – Conrad Oct 31 '18 at 05:53