I am using a .NET dll file for image operations and have added it in my C# application using "Add reference" in solution explorer and use its classes. There are many applications use that dll so I do not want to place the dll file in an application specific folder like:
C:\Program Files\<Application Name>\
orC:\Program Files (x86)\<Application Name>\
orC:\ProgramData\<Application Name>\
orC:\Users\<Username>\AppData\
And would like to place the dll file in a common folder like C:\Windows\
or C:\Windows\System32
folder or any other folder that is commonly accessible by all applications in Windows.
It works fine when I put the the dll file in the same folder of the calling exe, but when I place it in C:\Windows\System32
directory, the C# code of my application is not able to locate the dll and gives error:
Unable to load DLL: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
How do I instruct my code to look for the dll in the system32 directory or in any other common directory?
What other common folder can I use for shared dll and libraries?