Reputation: 27312
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:
Upvotes: 2
Views: 969
Reputation: 27312
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.
Upvotes: 0
Reputation: 7801
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.
Upvotes: 1