roslynpad
roslynpad copied to clipboard
Excel Interop, Could not load file or assembly
Describe the bug I use Microsoft.Office.Interop.Excel.dll in RoslynPad15 DotNet 6.0 to read and write Excel, but it shows error: "Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. " But it can run normally with dotnetFrameWork To Reproduce
Expected behavior
Version
- OS:Windows 11
- Build (or commit ID if built from source):RoslynPad15 and RoslynPad16
Thank you for reporting this issue π
It seems that the problem is not with RoslynPad but with the Microsoft.Office.Interop.Excel DLL Unfortunately, this DLL has not been updated to work with .NET 6 The latest framework compatible with Microsoft.Office.Interop.Excel is .NET 4.8
As an example, if we create a console application targeting .NET 6, we will get the same error:
Thank you for reporting this issue π
It seems that the problem is not with RoslynPad but with the Microsoft.Office.Interop.Excel DLL Unfortunately, this DLL has not been updated to work with .NET 6 The latest framework compatible with Microsoft.Office.Interop.Excel is .NET 4.8
As an example, if we create a console application targeting .NET 6, we will get the same error:
Thank you for your reply.
This Microsoft.Office.Interop.Excel DLL can be used in LinqPad7 with DotNet6.0, and it works well, so I guess there are some tricks that can fix this bug.
Microsoft.Office.Interop.Excel targets .NET Standard 2.0. As a result, this DLL can work with .NET 6.0. However, this DLL has not been updated to work with .NET Core by default.
If we take the example of the console application, it is necessary to import the DLL manually and to define the EmbedInteropTypes property.
Regarding LinqPad, indeed the developers have added the possibility to integrate the Office Interop COM libraries from the 6th version for .NET Core 3.1 and above.
So can we classify this issue as an enhancement?
I will try to work on it! π
@tsiank, I created a PR to solve this issue π Thank you for your feedback!
@jboinembalome οΌI have't thought it's fixed so quickly, thank you for your work, that's great! I will have a try.
@jboinembalome οΌI have tested, it works perfectly now, thank you again!
Good news! Youβre welcome @tsiank, it's a pleasure to help you π