I have a solution with a C++ project and a c# project, which calls methods from the first one using Interop.
As I want to avoid any hard-coded path, I found a way to set the C++ dll’s path in the app.config.
My problem is, that my C++ dll depends on other dlls, which I always have to copy into my bin/Release and bin/Debug folder. How can I avoid this?
It would be nice if I could set the path to the 3rd party dlls in the app.config.
I found this
<probing privatePath="bin\DLLs" />
but it seems to work for application subdirectories only.
Don’t hard code location for the DLLs. Put the directories into the %PATH% variable. Assuming Windows as environment read Search path for loading DLLs.
EDIT:
%PATH% is an environment variable, so you can set it with Environment.SetEnvironmentVariables. I would read privatePath from the configuration file, and use the given method to append it to %PATH%. Reading from the configuration file could be done with the ConfigurationManager class.