Search code examples
visual-studio-2010add-incom-interopoffice-interopmappoint

Add-in for MapPoint works on some machines and not on some others


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)

Solution

  • 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.