Unable to use Microsoft.office.interop packages
A great addition to dotnet scripts, interactive and notebooks would be the ability to use the Microsoft.office.interop packages like outlook, excel etc . This would make dotnet scripts an even better go to for small automation jobs and not always have to revert to Python .
What are you seeing when you try to use these? Can you give an example of what you're trying to do?
#r "nuget: Microsoft.Office.Interop.Excel"
Using Excel = Microsoft.Office.Interop.Excel;
var excelapp = new Excel.Application();
//if you try and run this in a c# polyglot notebook it will error out, researching online it says this will work in a visual studio compiled project , but this seems like great use case in dotnet interactive . Outlook interop works similar to the excel one , where you need to make new Application(); to use.
Here's the error I get when I try to run this:
Error: System.IO.FileNotFoundException: Could not load file or assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'. The system cannot find the file specified.
File name: 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
at Submission#1.<<Initialize>>d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
at Submission#1.<Initialize>()
at Submission#1.<Factory>(Object[] submissionArray)
at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
This looks like a bug in the package to me. I didn't realize that the package isn't Microsoft owned. You might consider reaching out to the package owner as the fix would have to be in the package in any case.