I’m trying to get access to my Excel document using the Interop in .NET. But Unity keeps giving me this error
–
Assembly ‘Assets/Plugins/Microsoft.Office.Interop.Excel.dll’ will not be loaded due to errors:
Unable to resolve reference ‘office’. Is the assembly missing or incompatible with the current platform?
–
-
I copied the Microsoft.Office.Interop.Excel.dll file from C:\Program Files\Microsoft Office\root\vfs\ProgramFilesX86\Microsoft Office\Office16\DCF into my Assets\Plugins folder in my project.
-
I select the .dll file in the Project panel and in the Inspector I tell it to only run in the Editor on x86_64 and Windows.
-
The Inspector tells me Assembly Info Targets .NET 4.x, so in the Player settings I set Scripting Runtime Version to .NET 4.x Equivalent, Scripting Backend to Mono (or IL2CPP, none of them work), and Api Compatibility Level to .NET 4.x. In the Build settings I have selected Windwos x86_64.
-
In Visual Studio Microsoft.Office.Interop.Excel is automatically added as a reference by Unity and I don’t get any errors in Visual Studio, InteliSense and syntax highlight is working as expected. Visual Studio confirms that this is version 16.
-
Software used: Unity 2019.1.14, Visual Studio 2017, Windows 10, Office 365 desktop softwares installed on computer.
–
What is the problem? Why doesn’t it work and why can’t Unity resolve the reference Microsoft.Office when Visual Studio clearly can do it? Why isn’t this working?