Home

LINQPad 6 error with referenced library.

I have a DLL I am referencing in a query and I am getting this error:
FileNotFoundException: Could not load file or assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.

This query works without issue in LINQPad 5, but does not work in the latest version. I'm kind of stuck as I'd prefer not to keep both versions installed unless necessary. The referenced DLL just returns a list from a legacy database table via a LINQ query. I do this so as I don't have a linked server and this data resides on a different DB server. That being said, I am sure there are some differences, but I am not sure what it is and how to resolve.

I tried to add a reference to the System.Data.Linq DLL and get this error:
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)

Comments

  • I take it you're running LINQPad 6? Because LINQPad 6 targets .NET Core, the assemblies that you reference are also supposed to target .NET Core (or .NET Standard). If you're trying to reference an assembly that targets .NET Framework, you may run into this error. Microsoft provide only partial support for .NET Core referencing .NET Framework.

Sign In or Register to comment.