I work for a team that currently specializes in creating windows desktop applications in C#/.NET that interwork with local user instances of Microsoft Excel via Office COM Interop. I am currently charged with specifying a new product but I’ve been told that the project will not go ahead unless the app can run on Mac as well as Windows – that is, we have to be able to produce a Mac version of the app that can install natively on OSX and interact with the object model of a user’s instance of Microsoft Excel for Mac.
Running the app with Parallels, Mono or Wine (see COM Interop Through Wine in OSX, which was never answered) is not a solution because the spec for the app requires that the user machine is not modified in any way. We just have to assume the user has a licenced local copy of Excel running, and work with that… which is what we have always done on Windows, where it works great.
I think .NET Core is the answer but I can’t find anywhere where it says definitely that we can (or will be able to) access the Excel Object Library from C# when running .NET Core on Mac OSX with a local copy of Excel for Mac installed. Can anybody point me please to where this has been discussed already; but if not, then tell me how I can go about finding out from Microsoft if this is in their roadmap for .NET Core?
First, Remove 'Microsoft. Office. Interop. Excel' nuget package, and then add reference to 'Microsoft Excel 16.0 Object Library' (right click the project -> 'Add' -> 'Reference' -> search and add 'Microsoft Excel 16.0 Object Library' ).
Go to the Project \Add Refference click on the "Browse" tab, locate the Microsoft. Office. Interop. Excel.
Yes, you are right. You need Excel to be installed to use the Excel Manipulation feature with Microsoft. Office. Interop.
I have received some helpful feedback from a similarly worded question on MSDN. I have also posted an issue on the .NET Core Github, but I think it is already clear what the answer is to this, which is as follows:
The bottom line: The very welcome .NET Core initiative looked like it was a fix, but sadly isn't, because of architecture limitations on OSX.
I have submitted this as an answer because I think I've come to the end of the line of enquiry on it, but if anyone thinks any of the above is incorrect, please shout!
Thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With