C#.Net Static Linking Adventures
My app uses two DLLs - say Lib1 and Lib2 from a CommonDll folder. With normal linking these DLL's also need to be placed with App executable. But previously we have been providing only App exe only. Hence to keep the compatibility and to lessen deployment headaches, the above 2 DLLs will be statically linked in the executable. In .Net world this not so straightforward as setting a static linking flag in linker. Here we need to provide following steps. I have added the rationale for each step alongwith. 1. Add the DLL's to project as resources - preferably in a Resources folder. Go into these DLLs properties and change "Build Action" from "Content" to "Embedded Resource". Now the DLLs shall get embedded in the exe. 2. Provide a handler for AssemblyResolve event. This new handler looks for assemblies in Resources and if found, loads them there. This handler is like below: private static Assembly ResolveEventHandler(Object sender, Resol...