Unpacking on the fly in C #

I created a console application that works fine when it refers to a .exe file from program files, but my users may not have this .exe in their Program Files directory.

I would prefer to save the package as a single .exe for simplicity, so I was wondering how I can combine both .exe into one package.

One thing that I was thinking about was zipping.exe from the Program Files directory to a temporary location, and I would save the binary data for the zip archive in the console application source code. Is this the best way to do this, or are there better methods?

Note. I do not have .exe source code. I want to reference in my console application.

+3
source share
3 answers

.exe( .dll) . " " " ". ( , ), : System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("stream name")

, , Assembly.Load(), .

: , Vista Windows 7 ( XP), () Program Files .

+3
+2

Take a look at this link: Embedding assemblies inside another assembly

Basically, ILMerge will do what you ask.

0
source

Source: https://habr.com/ru/post/1759948/