C # DLL link changes version and becomes inactive (plugin system)

I will try to make it as simple as possible. I have a pretty simple plugin system that ran into a problem.

I have 2 assemblies:

  • host.exe
  • Plugin.dll

Plugin.dll refers to Host.exe (which contains the interfaces and classes that Plugin.dll implements and uses).

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

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

Has anyone got a solution?

+3
source share
3 answers

There is a simple solution, do not change your [AssemblyVersion], only your [AssemblyFileVersion]. To make this meaningful, it is better to move the classes that are necessary for both the plugin and the host for a separate assembly.

Now that you make changes to one of these classes, you can modify [AssemblyVersion] to force the recompilation of the plug-in. Now this is a good thing, not a problem.

+2
source

Try moving the interfaces specified in Host.exe to a separate DLL, for example. PluginSupport.dll and use the Plugin.dll link instead.

+2
source

App.config - , .

+1

Source: https://habr.com/ru/post/1740186/


All Articles