system.data.linq in .net core

12345 1 Reputation point
2022-04-27T18:33:37.757+00:00

I created a asp.net core + react project in visual studio 2022.
The new project references some other projects that use system.data.linq,
but in .net core I can't access the assemblies.
I tried adding this assembly by browsing it, but then I got this error:

System.BadImageFormatException: 'Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (0x80131058)'

how can I solve this?

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,164 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 56,021 Reputation points
    2022-04-27T20:03:55.433+00:00

    .net core apps can only access .netstandard 2.0+ and .netcore libraries. to use your other projects they must be converted to .netstandard 2.0+ or a .net core framework. .netstandard projects should not reference 4.* projects or dlls (but early versions of the tools allowed this).

    System.Data.Linq was not ported to .net core. there is an unofficial nuget port of the code.

    https://www.nuget.org/packages/netstandard-System.Data.Linq/

    .