Plugin assembly path to find other needed assemblies

L

Luis Arvayo

Actually it is:

How to define the plugin assemblies path in order to find other assemblies
which the plugin depends on.

Example:

If I have:

c:\myapp\application.exe

then, other assemblies are also installed on the same subdirectory, example:

c:\myapp\assembly1.dll
c:\myapp\assembly2.dll


Then in subdirecory Plugins under main subdirectory I installed the plugins:

c:\myapp\Plugins\plugin1.dll

But plugin1.dll also depends on

c:\myapp\assembly1.dll

as same as application.exe.

When runtime, there is an error when loading the assembly (with
Assembly.Load(xxx)) that dependant assemblies on plugin1.dll were not found
(c:\myapp\assembly1.dll).

How to solve this without moving the plugins assemblies to the main
subdirectory ?

Thanks in advance
Luis Arvayo
 
F

Frans Bouma [C# MVP]

Luis said:
Actually it is:

How to define the plugin assemblies path in order to find other
assemblies which the plugin depends on.

Example:

If I have:

c:\myapp\application.exe

then, other assemblies are also installed on the same subdirectory,
example:

c:\myapp\assembly1.dll
c:\myapp\assembly2.dll


Then in subdirecory Plugins under main subdirectory I installed the
plugins:

c:\myapp\Plugins\plugin1.dll

But plugin1.dll also depends on

c:\myapp\assembly1.dll

as same as application.exe.

When runtime, there is an error when loading the assembly (with
Assembly.Load(xxx)) that dependant assemblies on plugin1.dll were not
found (c:\myapp\assembly1.dll).

How to solve this without moving the plugins assemblies to the main
subdirectory ?

In the application.exe.config file, add:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="Plugins"/>
</assemblyBinding>
</runtime>

This will tell fusion to look in the subfolder Plugins for referenced
assemblies as well. Check the probing tag's documentation for more
details :)

Frans

--
 
L

Luis Arvayo

Thanks for the answer, but...

Your suggestion works only for the main application which I already had
defined before posting. But it seems that it is ignored for the plugin,
because the error is raisee when issued the Assembly.Load(xxx)

Regards
Luis Arvayo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top