For the life of me, I can\'t seem to get my .NET 4 application merging properly with ILMerge. Even after setting /targetplatform, /lib, /ndebug and adding a custom
You could try Costura.
https://github.com/Fody/Costura#how-it-works
It basically takes Jeffrey Richters appraoch
http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx
But does it in a way that you dont need to write any code. ie you dont need to write the "AssemblyResolve" method