I would like to use openCV with EmguCV, but I dont want to add openCV dlls as a reference, and I also don't want to copy all openCV dlls to bin folder. How can I give a folder to my project to let it know that the required dlls are there?
- Not sure to understand because if you want to use it why not wanting to add them as references? You can take a look at this: stackoverflow.com/questions/6758184/importing-a-dll-in-c-sharp that lets you user/import (in code) what you need but i don't see any benefits of using this compared to just reference them in your project.Dimitri– Dimitri2019-03-10 16:05:28 +00:00Commented Mar 10, 2019 at 16:05
- I will make a lot of similar project in the near future. It is easier if I just add the location of the c++ dll-s, and not copy all of them to the project folder.THE_GREAT_MARKER– THE_GREAT_MARKER2019-03-10 20:00:38 +00:00Commented Mar 10, 2019 at 20:00
1 Answer
I think THIS is something you are looking for, you should follow the (well explained) steps of the Author and you should be fine.
This will read your added embedded resource (dll in your case) and Load/compile it at runtime by its location (and other logic).
Quote:
The DLLs are not distributed with the application, when the application fails to locate the DLL, it raises an Event of AppDomain.CurrentDomain.AssemblyResolve. AssemblyResolve is requesting the missing DLL. Then, we will tell our application to look for the DLL in memory. Use EmbeddedAssembly.Get to retrieve the DLL from memory and pass it for AssemblyResolve to handle the rest.