How to change the link loading path in .NET?

I need a setup like this:

+- /ApplicationFolder
  -- App.exe
  -- Core.dll
  -- AnotherShared.dll
  +- /PluginsFolder
    -- plugin1.dll
    -- plugin2.dll

But since plugin1.dll refers to Core.dll and Shared.dll when compiling the application, it also removes a copy of “Copy.dll” and “Shared.dll” into the plugins folder, and if I delete them, don’t work anymore.

How can I solve this problem?

+1
source share
3 answers

When creating an AppDomain, you can determine the path to load assemblies. Install AppDomainSetup.PrivateBinPathand go to the AppDomain.Create domain.

Using AppDomain is a good idea for plugins (allows you to distinguish between CAS and offload).

VS/msbuild , " " false .

+5

MEF , ( - ), post-build .

, , , "" " " false.

+1

: PrivateBinPath MEF?

Appdomain.AssemblyResolve, .net . , .

AssemblyResolve jsut , , null, Core.dll AppDomain.GetAssemblies().

Code.dll plugin1.dll,.net , Core.dll

+1
source

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


All Articles