1

I created an .exe project from C# project. It has a lot of DLL files. How can I hide this files or embed into project? Because, I don't want to be seen DLLs that I've used.

Thanks in advance.

Edit : Some of DLLs are mine, some of not mine, They are third party DLLS.

dbc
  • 104,963
  • 20
  • 228
  • 340
1teamsah
  • 1,863
  • 3
  • 23
  • 43
  • Are these DLL developed by you or are thirdy party ones? – Steve Jan 23 '14 at 08:43
  • See http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx - although anyone looking will still be able to find the same code/data... – Jon Skeet Jan 23 '14 at 08:43
  • Some of DLLs are mine, some of not mine, They are third party DLLS. – 1teamsah Jan 23 '14 at 08:47
  • *Hiding* is easy, store them inside package (zip, resources, etc) and run your application via stub. Stub is a small exe-file, which extracts dlls (exe-file, other files) into temporarily folder, run main exe and (optionally) clean after. There could be readymade *exe packers* to avoid necessity of making stub yourself. – Sinatr Jan 23 '14 at 10:12
  • @Sinatr How can I make Stub? – 1teamsah Jan 23 '14 at 13:57
  • Stub is just a word. I mean something what [`NSIS`](http://nsis.sourceforge.net/) does. It puts installation files into a single exe-file. You could try to use NSIS (create installation which doesn't have any UI, but install files into temporary location and run your exe), you can use self-extracting achieve or you can simply create a new project, where all dlls and exe from original project will be put inside new project exe file as *embedded* resources (you have to extract them into temporary location and run exe). – Sinatr Jan 23 '14 at 14:06
  • Related: [How to merge multiple assemblies into one?](https://stackoverflow.com/q/8077570). – dbc May 12 '19 at 06:58

2 Answers2

3

You can use ILMerge, a utility from Microsoft to merge assemblies into a single assembly (.EXE).

Find out more at http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx

If, however, you have a WPF project, the recommended alternative is to embed the referenced assemblies as resources and to load them as necessary. You can find out more about that approach at Jeffrey Richter's blog at http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx.

Roy Dictus
  • 32,551
  • 8
  • 60
  • 76
1

Integrate the Code from the DLLS as a part of the EXE in your project.

Alternatively you can try ILMerge:

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.

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130