In the context of the question
In Excel-DNA adding a new line in context menu at right-click on a cell in a spreadsheet
I need to use the _Application.CommandBars
property from the Microsoft.Office.Interop.Excel
namespace -- see https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.excel._application.commandbars?view=excel-pia.
I made my code work by adding reference to the Office.dll, but I was surprised that this was the only way for which Core
from Microsoft.Office.Core
was recognized, allowing me to use the _Application.CommandBars
property.
Being in a development context where I am forced to reference NuGet packages rather than DLLs, I naturally tried to add the https://www.nuget.org/packages/Microsoft.Office.Interop.Excel Nuget package and add the following error :
The type 'CommandBars' is defined in an assembly that is not referenced. You must add a reference to assembly 'office, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'
telling in fact to reference the Office.dll rather than the NuGet package ... so that I am really stuck here.
Also, there is no Microsoft NuGet packages for Microsoft.Office.Core
, even if there are non-Microsoft packages, maybe revealing that the problem I have is a known one.