Buddha
Buddha

Reputation: 195

Microsoft Interop Excel with .Net5.0 is not working

I am trying to migrate my existing WCF service to .Net5.0 Web API. Currently we have Excel Interop dependency to implement excel cells update, running macro inside excel & then capturing the screenshot of specific cell range.

When I am trying to add Microsoft Interop with .Net5.0 using nuget package, seeing warning like it is not compatible other than .Net Frameworks.

Can anyone help me is it possible to add nuget package to .Net5.0 Web API project?

Upvotes: 5

Views: 6386

Answers (1)

Brando Zhang
Brando Zhang

Reputation: 27962

As @Alexey Rumyantsev says, the Microsoft Interop wouldn't be possible to port to .Net core because it relies on the Office interops. The Office interops is windows ony feature. More details ,you could refer to this github issue.

If you still want to use Microsoft Interop Excel in asp.net core, I suggest you could try to create a new .NET Framework 4.X project. Add the relevant COM references to the project. Edit the .csproj of your .NET Core 5.0 project and add the generated references from the .NET Framework project to the tag.

Notice: We don't suggest you use this way, we suggest you use other EXCEL library.

More details, you could refer to this answer.

Upvotes: 4

Related Questions