Original: Put DLL in exe[.net]
Two scenarios:
1. Use the Ilmerge tool.
Cons: You need to leave the project and use a third-party tool (Ilmerge).
2, the DLL as resource into the Exe,exe execution when the dynamic load (load) resources within the DLL.
Cons: Need to write extra code, load speed problem.
Reference code:
Public Partial classapp:application{ PublicApp () {AppDomain.CurrentDomain.AssemblyResolve+ = (sender, args) = ={Assembly thisassembly=assembly.getexecutingassembly (); //Get The Name of the AssemblyFile varname = args. Name.substring (0, args. Name.indexof (',')) +". DLL"; //Load Form Embedded resources-this Function is not called if the Assembly are in the application Folder varresources = Thisassembly.getmanifestresourcenames (). Where (s = =S.endswith (name)); if(Resources. Count () >0) { varResourceName =Resources. First (); using(Stream stream =Thisassembly.getmanifestresourcestream (resourcename)) { if(Stream = =NULL)return NULL; varblock =New byte[Stream. Length]; Stream. Read (block,0, block. Length); returnassembly.load (block); } } return NULL; }; }}
Put the DLL in Exe[.net]