Question

I am getting the following error when compiling a Boo project which uses interop:

textbox = _ActiveWorkSheet.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, left, top, width, height)

The best overload for the method 'Microsoft.Office.Interop.Excel.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation, single, single, single, single)' is not compatible with the argument list '(Microsoft.Office.Core.MsoTextOrientation, single, single, single, single)'. (BCE0017)

As you can see the signatures are the same, the issue seems to be recognising MsoTextOrientation.

I installed PIA for 2010, can add a reference to COM "Microsoft Office 14.0 Object Library", and can import the Microsoft.Office.Core namespace from it. It just falls apart at the method signature.

I am using boo compiler version 0.9.1.3287, as embedded in Sharpdevelop 3.2.1.

Any ideas?

Was it helpful?

Solution

OK,

It turns out there are two ways of bringing the Microsoft.Office.Core namespace into the project:

  1. Import "Microsoft Office 14.0 Object Library" from COM (shows up as "Office" in your references)
  2. Import "office" from the GAC (shows up as "office" in your references)

I don't know why it's listed as just "office" in the GAC Add reference list instead of "Microsoft.Office.Core". That's why I missed it and ended up looking in COM instead, and seeing the namespace imported fine I thought it was all OK...

I don't know enough about how identical namespaces from different assemblies are handled, but is it a possibility that the types are flagged as not being compatible is just a boo/Sharpdevelop issue? I'd expect a lot more people to have this issue is it happened with visual studio/C#...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top