Problems detecting plugins made with System.Addin

477 views Asked by At

I am using System.Addin to create plugins for a small portion of my application. I have two different plugins at the moment, and they are both detected and initialized correctly. I can even copy & paste the plugin folders that are created and I will see them appear as well.

Everything works great when I'm playing around in the debug and release folders. The problem comes in when I attempt to drop one of the plugins into the plugin folder where the application is installed. The copied plugins in are never detected, even though nothing has changed in the contract, views, or adapters.

I've tried copying and pasting plugins from a different installed version of the software (in which the contract is still identical).

I've found that the only way to make this work is to copy all of the folders relating to the plugin architecture: AddIns AddInSideAdapters AddInViews Contracts HostSideAdapters HostView.dll

I would guess that copying over all of these dlls sort of defeats the purpose of a plugin.

Has anybody else had these problems with the new System.AddIn?

Edit: Plugin was created using the pipeline builder tool

2

There are 2 answers

0
Peter McEvoy On

MAF is very sensitive to the DLL versions of the HostView, Contract and AddInView assemblies. An AddIn that references a particular DLL version of the AddInView interface will always want that exact version. Likewise the AddInAdapter should reference the same DLL version of the AddInView. If you build a new AddIn, it must link to the exact same version DLL that the AddInAdapter is linked to.

For our implementation, I ensure that the HostView, Contract and AddInView DLLs are packaged in individual nugets and that those VS projects are not part of the same solution as my AddIns or Adapters. Then within the packages.config of the HostAdapter, AddInAdapter and individual AddIns, I make sure we use the allowedVersions attribute on the package element:

    <package id="AddInPipelineSegments.AddInViews.AddinViewV1"
         version="139.37.8.1011"
         allowedVersions="[139.37.8.1011]"
         targetFramework="net451" />

This ensures that there are no accidental nuget upgrades that would change the version..

0
Denis Vuyka On

Have you tried analyzing the addin store cache? Maybe this is the source of the issue. Take a look here for a methods available.