2

I developed a minimal (without MapPoint Object Library, because it's a test) add-in for Microsoft MapPoint using Visual Studio 2010, written in C#.

With setup project I can install my add-in on some PCs that run MapPoint 2010 or 2011, but on some others installation has no effect.

That is it seems to finish successfully, but when I open MapPoint the add-in is not running; if I open Tools > COM add-ins... I find my add-in unchecked, checking it has no effect and adding it manually tells me

'C:\Path\to\myAddin.dll' is not a valid Office add-in.

Doing some tests I found out the problem is not related to a certain MapPoint version, Windows version or platform version.

Which can be the differences that lead the add-in to work on some machines and not on some others? Thanks!


Details on how I created the add-in:

  • install MapPoint 2011 Europe
  • launch Visual Studio 2010
  • File > New > Project... > Shared add-in > give a name to the project > OK > check just Microsoft MapPoint > go on to the end
  • Soluzions explorer > open Connect.cs and write the code
  • build all projects in the solution (with MapPoint turned off)
  • use the .msi generated by setup project to install the add-in on the target machine (where MapPoint is already installed)
bluish
  • 26,356
  • 27
  • 122
  • 180

2 Answers2

1

Yes I wrote the Late Binding article and agree it isn't the best way of using MapPoint, although sometimes you have to use it.

You shouldn't be accessing the MapPointControl when creating an add-in. You only be accessing the object model. Barring any API differences, if you reference 2006 or later, it should work with all subsequent versions. Ie. Your 2010 built add-in should work with 2011.

The not a valid office add-in error is obtuse, but really this is caused by the shim that sits between MapPoint and your .NET add-in. The shim makes your .NET DLL look like a COM add-in.

winwaed
  • 7,645
  • 6
  • 36
  • 81
  • +1 Thanks for your help, but now I changed my question because my tests show me it's not a matter of MapPoint version, so your answer goes out-of-topic... :( I also found the solution and I'll post it now. I found it thanks to one of your add-ins (!), [MPSuperShape](http://www.mpsupershape.com), looking through the DLLs it includes. Thanks a lot again! – bluish Jul 18 '12 at 15:50
0

After hours of tests I found it! Thanks to an investigation inside MPSuperShape installation folder :).

Extensibility.dll is needed, in the same folder where my add-in is installed. When creating a shared add-in project in VS, Extensibility is automatically added to References, but not to the list of files that the installer will put in program folder.

Hence you have to: right click on the auto-generated setup project > Add > Assembly... > .NET > Extensibility > OK. Build, install and you've got it!

I add that, if you use MapPoint Object Library (as you probably do if it's not a test add-in like mine) you need to add Interop.MapPoint.dll in a similar way: right click on the auto-generated setup project > Add > Assembly... > Browse > pick such DLL from your bin\Debug or obj\Debug folder in your main project.

Why was Extensibility.dll not needed on some machines?

Because if you have Microsoft Office 2007 or later (as I saw) it is already present (in C:\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies) and in some way it is loaded when you run MapPoint.

bluish
  • 26,356
  • 27
  • 122
  • 180