Say I have a .NET/CLR program Hello.exe
(or a DLL Hello.dll
) that depends on various third-party .NET DLLs. I want to ship a single file, without providing an actual "installer", so I am looking for some software that can pack all of the dependencies into the executable, then load them before any of my code starts to run.
I also need it to unconditionally load every DLL that is supplied, not only "on-demand", because some of the types in the DLLs are accessed via reflection and so the class loader will never attempt to explicitly load the DLL and thus call the class loader hook. I don't want to have to add code to my executable if it's possible to do this without any of my own code.
I am using SharpDevelop and .NET Framework 4.0 Full Profile, but the ideal solution to this problem will be IDE-agnostic, and work with .NET 3.0 or later (2.0 would be even better, but let's not get greedy...)
Assembly.LoadFrom
to do the actual work?