For our application we use a messaging system where using the information in the message we can build various objects using reflection on the fly. A simplified version of this is:
if(Message.Control == "ControlA")
Assembly.LoadFrom("ControlsA.dll")
else if (Message.Control == "ControlB")
Aseembly.LoadFrom("ControlsB.dll")
Once we have the assembly we then invoke various methods as required.
The problem at the moment is that when we use this method for Windows 7 installations we receive a “Could not load file or assembly” error where the path that is reported as been searched is the users desktop directory where the application was launched from via a short cut (C:\Users\*user*\desktop).
My question is; why is the above method not looking in the Application Path for the DLLs in Windows 7 when it works in XP, should we be doing something differently?
How about using
to get the path of the currently executing code? It should be easy to find your libraries when you have this info.