Compile all C # files into one file?

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

+6
c #
source share
4 answers

One way is to use ILMerge . This will combine several assemblies into one (consider combining all the DLLs and the main exe into one exe).

+12
source share

Yes :) But you have to put all the sources in one assembly and compile it into EXE. Also note that the target system must also have the .NET framework installed.

Please note that security policies on the target system may prevent your application from starting directly.

Finally, if you do not " NGEN " your code, it will be jitted on first launch. This will require some startup time. In some cases, this can be significant.

+2
source share

If you also want to combine the .NET assemblies your application needs, you can use something like This to even compile on System. dll, System.Windows.Forms.dll, etc., so the end user does not even need .Net.

+2
source share

I got this from a similar question (sorry, who posted the answer - I can't find the original to link it here):

how to embed your application dependent dlls inside your exe file

This is an excerpt from Jeffrey Richter CLR Via C #. I have not tried it yet, but it looks very promising. I think that it will work with WPF (I'm going to find out for myself).

0
source share

All Articles