Well, a very bad strategy — to find any type or member by name. You never need it to implement plug-ins.
Do the following:
1) Create a plug-in interface, reference it by both host-and plug-in projects.
2) Make all attribute you need either a part of your interface or just use assembly attributes. You can develop a dedicated versioning system and the rules for version compatibility. Both host and plug-in implementation can perform the check-up.
3) Implement this interface in some plug-in class. In this way, you don't need to search anything by name; look at all classes and pick one which implements the interface; if more then one classes do — do something about it, for example, use just first one you found but issue warning.
4) Make a step further. Why searching through all classes (even all public, does not matter)? Make it more effective. Create some attribute with the target "assembly" to claim the class(es) implementing certain plug-in interface(s), the parameter could be
System.Type
or two parameters of
System.Type
— one parameter claims that the plug-in interface of certain type is implemented in the assembly (so you may use more than one interface type), second parameter will claim the class/structure implementing this interface. If in real time doing Reflection you will find mismatch — throw exception or something like that.
See my past solutions describing plug-in architecture:
Create WPF Application that uses Reloadable Plugins...[
^],
AppDomain refuses to load an assembly[
^].
Some part of these solution can be too complex for your purposes. You may want to ignore the requirement for the plug-ins to be reloadable and hence working with additional Application Domain — this is the most difficult part. If you need "just plug-ins", not reloadable, it's nearly as simple as what you already done.
Any questions?
Good luck,
—SA