Package the entire C # Console application in one file?

Is it possible to pack an entire C # console application with its application folder / files into one executable .exe file, so there is no need to install it on a computer when it is launched?

+4
source share
1 answer

If it does not have many DLL resources (with translated strings in separate subfolders), you can use ILMerge for this for DLL files:

http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx

ILMerge is a utility that can be used to combine multiple .NET. assembly into a single assembly.

, .

, , . :

http://support.microsoft.com/kb/319292

: :

 var assembly = Assembly.GetExecutingAssembly();
 var stream = assembly.GetManifestResourceStream("MyNamespace.MyResourceFileName");

 // ... do something with stream, e.g. write it out to a file.

[EDIT]

ILMerge .

. : http://blog.nenoloje.com/2011/08/better-alternative-to-ilmerge.html

: http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx

ILMerge " ILMerge, , ! , ILMerge"

, , .:)

+7

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


All Articles