tags:

views:

86

answers:

3

I will try to keep this as simple as possible. I have a rather simple plugin system that has run into a problem.

I have 2 assemblies:

  • Host.exe
  • Plugin.dll

Plugin.dll references Host.exe (which contains interfaces and classes that Plugin.dll implement and use).

At runtime, Host.exe loads Plugin.dll through reflection and this works great. Except when Host.exe updates and gets a new version number. Then I get an error once I try to load Plugin.dll, saying that Host.exe (with the old version number) can't be found.

This means I have to rebuild all plugins every time Host.exe changes build number.

Anyone got a solution to this?

+2  A: 

Try moving the interfaces referenced from Host.exe into a separate DLL, e.g. PluginSupport.dll, and have Plugin.dll reference that instead.

Matthew Ferreira
A: 

Add an App.config file to the host project with a binding redirect that redirects all versions of the host assembly to the current version.

SLaks
+2  A: 

There's a simple solution, don't change your [AssemblyVersion], only your [AssemblyFileVersion]. To make that meaningful, it is certainly better to move the classes that both the plug-in and the host need to a separate assembly.

Now, when you make a breaking change in one of those classes, you can change the [AssemblyVersion] to force the plug-in to be recompiled. Which is now a Good Thing instead of a problem.

Hans Passant