Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile all C# files into one file?

Tags:

c#

.net

Is there a way to compile C# files into one single file that is ready to give to the user?

like image 758
Kredns Avatar asked Feb 15 '09 03:02

Kredns


People also ask

What is GCC command in C?

GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++.


3 Answers

One way is to use ILMerge. This will merge multiple assemblies into a single one (think combining all DLLs and a main exe into a single exe).

like image 57
denis phillips Avatar answered Oct 07 '22 15:10

denis phillips


Yes :) But you must put all your sources into a single assembly and compile it to an EXE. Also note that the target system must also have the required .NET infrastructure installed.

Note that security policies on the target system may prevent the user from directly running your app.

Lastly, unless you "NGEN" your code, it will be jitted the first time it runs. This will incur some startup time costs. THese can be considerable in some instances.

like image 21
Foredecker Avatar answered Oct 07 '22 16:10

Foredecker


If your looking to also merge the .Net assemblies required by your app, you can use something like This to even compile in System.dll, System.Windows.Forms.dll, etc, so the end user wont even need .Net installed.

like image 45
Neil N Avatar answered Oct 07 '22 17:10

Neil N