I consuming my service stack using EXE project (startup task for azure application) in that I have copied following service stack's DLL & some Azure's DLLs in to EXE project.
When I build this EXE project then Azure DLLs will be bundled with my EXE but service stack's DLL will not be bundled with EXE, because to run my EXE on any machine I need to copy all service stack's DLL manually.
I have used this service stack's dll to use
JsonServiceClient client = new JsonServiceClient(servicepath);
What should I have to do to bundled all these DLLs in to my EXE?
Yes, it is impossible to merge dll files; there is no tool to do it and it cannot be done manually either. You must modify the source code.
Add DLL As Embedded Resource First, add the DLL as Reference. Then, add the same DLL as file into the project. Right click the project's name > Add > Existing Item... The same DLL will exist twice in different folder in the project.
You have several options:
OR
OR
AssemblyResolve
handler which at runtime reads from Resources and returns the needed DLLs to the .NET runtime...A great tool to include referenced assemblies as embedded resources is Costura (a Fody add-in). The author Simon Kropp describes it as follows:
[...] a combination of two methods:
- Jeffrey Richter's suggestion of using embedded resources as a method of merging assemblies
- Einar Egilsson's suggestion using cecil to create module initializers
The result is a super simple solution which merely requires to fetch Costura.Fody from NuGet.
Features:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With