Failed to save a file using ExcelFile

Im using ExcelFile to edit a excel file, then saving it as a pdf file. Everything is working on ASP.Net, but when im using Blazor it didn’t work. The error that i got is:

"Could not load file or assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified."

I thought im missing “PresentationCore.dll” for the references, so i check at the ASP.Net project and using the same dll file, but still got error:
"Could not load file or assembly 'PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (0x80131058)"

And then i try the “PresentationCore.dll” but with version 3.0, and still got error like this:
"Could not load type 'MS.Internal.SecurityCriticalDataForSet`1' from assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'."

Thank you

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I’m not familiar with ExcelFile but looking at the two errors it would suggest it’s a .NET Framework library. If this is the case it won’t work with Blazor or ASP.NET Core.

Blazor and .NET Core only work with .NET Standard 2.x libraries (and .NET Core 2.x or 3.x in some cases)

You need to find an alternative


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x