❔ Migration from .NET Framework 4.8 to .NET7, Need .NET Standard?

We have a project that is using LINQ-To-SQL and .NET Framework 4.8. The DAL is a separate Class Library project to the UI. We have been tasked with getting this DAL into a .NET 7 API to use with a desktop app that is being rewritten in .NET 7 (Possibly Blazor or React). So the 2 systems will talk to the same API however 1 DAL will be EFCore .NET 7 and 1 will be LINQ-TO-SQL (for now, until we re-write this in EFCore too).

I thought the approach might be .NET Core API > .NET Standard 2.0 > .NET Framework 4.8

However when trying to access the .NET Framework 4.8 DataContext I get Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0 from my .NET Standard 2.0 Class Library

.NET 7
        [HttpGet]
        public void GetDevices()
        {
            _deviceBridge.GetDevies();
        }


.NET Standard 2.0
        public void GetDevies()
        {
            DeviceFrameworkLogic deviceFramework = new DeviceFrameworkLogic();
            deviceFramework.GetDevies(); // <- exception thrown on this line.
        }

.NET Framework 4.8
        public void GetDevies()
        {
            ProjectDataContext dc = this.Session.NewProjectDataContext();
        }


When I reference System.Data.Linq (in .NET Standard or .NET 7) I get BadImageFormatException: Cannot load a reference assembly for execution. at runtime.

I've also tried "Mindbox.Data.Linq" which is "A clone of Microsoft System.Data.Linq to allow multi-DLL extensibility and EF compatibility." Sadly still doesn't work.

Am I approaching this all wrong?
I've read .NET 7 might not even need .NET Standard however I'm getting a similar problem with System.Data.Linq when using just the .NET 7 > .NET Framework 4.8 in regards to System.Data.Linq.
Was this page helpful?