Home

How does LinqPad 7 with .NET 6 support Office COM and LinqToSql?

edited July 2022

I noticed that the Add References window in Linqpad 7 has buttons specifically for adding references to Office COM interop assemblies and LinqToSql.

...which I thought shouldn't be possible because Microsoft has made it clear that you can only use .NET Framework 4.x to interop with Office' COM automation APIs, i.e. that we cannot use .NET Core nor .NET 5 or later.:

VSTO relies on the .NET Framework. COM add-ins can also be written with the .NET Framework. Office Add-ins cannot be created with .NET Core and .NET 5+, the latest versions of .NET. This is because .NET Core/.NET 5+ cannot work together with .NET Framework in the same process and may lead to add-in load failures.

...but LinqPad 7 seems to support it just fine and it works on my machine to control Word and Excel (I'm currently on Office 365, version 2109). How does it do this - and can we use whatever tricks it uses to use Office automation from normal .NET 6 programs?

As for LinqToSql, I see that LinqPad includes a private build of System.Data.Linq.dll to .NET 6 - I'm assuming this was rebuilt from the original .NET Framework-exclusive assemblies - but to what extent can we use it outside of LinqPad? (Not that I'd ever recommend it over EF Core, but I'm just curious)

Comments

Sign In or Register to comment.