In short: the only way that may work is to add all external files as an embedded resource and use ILMerge
.
Option #1: the following steps show how to embed a resource file Inside Visual Studio :
- Go to Solution Explorer,
- Right click the resource file,
- GO to Build Actions: Select Embedded Resource.
You will have that file reference inside the exe. Later you can use Reflection and get the resource when you run your application. Borrowed Source Code from here:
Option #2 with managed dll's:
For the managed DLLs you have a couple of options:
- Use ILMerge. ILMerge has a nice GUI interface that can be found [here]7]
- Embebed them as a resource, see this article for details.
Check out the following CodeProject article that explains this .
ILMerge is a utility that can be used to merge multiple .NET assemblies into a single assembly. ILMerge takes a set of input assemblies and merges them into one target assembly. The first assembly in the list of input assemblies is the primary assembly. When the primary assembly is an executable, then the target assembly is created as an executable with the same entry point as the primary assembly. Also, if the primary assembly has a strong name, and a .snk file is provided, then the target assembly is re-signed with the specified key so that it also has a strong name.