P
P
PavelG20102019-09-03 12:57:03
C++ / C#
PavelG2010, 2019-09-03 12:57:03

How to download NuGet packages for a dll not located next to an exe?

My application uses a plugin loading system, plugins are stored in the "Plugin" folder in the current user's documents folder. Plugins are stored in documents so that plugins can be loaded or updated while the application is running.
I'm having a problem when using NuGet packages inside plugins.
The plugin is loaded via the "Assembly.LoadFrom" function and an error occurs during loading:
System.Windows.Markup.XamlParseException: "Failed to load file or assembly "Xceed.Wpf.Toolkit, PublicKeyToken=3e4669d2f30244f4" or one of their dependencies. Cannot find specified file."
If exe and dll are placed in the same directories, then no error occurs.
I suspect that the program is looking for "Xceed.Wpf.Toolkit" not next to the plugin being loaded, but next to the exe.
How do I add a plugin directory to search for NuGet packages in it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2019-09-03
@petermzg

AppDomain.AssemblyResolve += OnAssemblyResolve;
And there you specify the required full path to the dll

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question