It seems the method always fails when using EdmAddAddInFlags.EdmAddin_ReplaceDuplicates,
Removing the flag give me an exception when the addin is already there.
If I delete the addin using pdm administration, it is re-added without issue.
What else should I try?
It's not possible.
I got an answer from support,
The EdmAddAddInFlags.EdmAddin_ReplaceDuplicates functionality is broken,
and the RemoveAddin method doesn't exist yet.
Here's 2 SPR about the issue:
SPR 907044 – Need API for adding files to installed add-ins and removing or replacing files that are already part of an installed add-in (IEdmAddInMgrX)
SPR 830144 – Need API for removing files from an add-in or remove an add-in entirely
Daniel Seaman from support has confirmed that the only workaround is to remove the addin with PDM Administration.
His answer about the timeframe:
I can’t really give you an indication of when these issues are likely to be resolved. They would be most likely be resolved as part of a major release though and that would be SW2017 at the very earliest.
I hope it will be resolved before 2017...
Thanks a lot for your help