I am developing a c# console application that requires some 3rd party assemblies(DLL). On dev machine, I know about the location of these assemblies so I can add them as reference to VS2010 project. But I am not sure of these assemblies path at client(user) machine.
I can get these assemblies location from an environment variable or by an registry value ( may be added by 3rd party tool or by user).
So how will my application load these assemblies?
I am developing a c# console application that requires some 3rd party assemblies(DLL). On
Share
If the assemblies are installed on the client, they are automatically loaded because they should be in the GAC. if not, they should be in the same folder as the .exe, or you can load them programmatically with the Appdomain.AssemblyResolve event. This event is fired if an assembly can’t be found:
//EDIT:
Watch out with this, there are sometimes a lot of assemblies that can’t be found, and it’s usually not a problem because it just searches on other places. But if you decide to rewrite this and try to load all assemblies which aren’t found, i.e. remove the file.exists, your code will break.