I could have sworn there are several tutorials on this, but I can’t seem to find them, and can’t remember how I did it in the past (been years and with a different company)…
I’ll be working in C#. I think what I did was create an interface with the needed properties/methods for the app and plugin to communicate back and forth…
Run the app, and scan a folder for the plugins, load the plugin and interact with it via the previously mentioned interface…
If the above is on the right track, can someone point me to an example of loading the plugin or better, a tutorial?
Thanks!
There’s plenty of ways for it, but simple:
Scan for folder :
Then load assembly (for each file above)
From Assembly to enumerate types:
Check if type implements your interface
Then to instanciate:
That’s about it, exception handling and other bits omitted of course
Some DI packages can do lot of that work for you, depending on your use case they can be very useful or just overkill.