Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a .NET windows application be compressed into a single .exe?

Tags:

.net

windows

I am not too familiar with .NET desktop applications (using Visual Studio 2005). Is it possible to have the entire application run from a single .exe file?

like image 372
public static Avatar asked Sep 24 '08 11:09

public static


People also ask

Can you compile C# to exe?

To force the compiler to generate a real, standalone executable (which means you use C# like any other language) you use the program mkbundle (shipped with Mono). This will compile your C# app into a real, no dependency executable.

How is .EXE file created in C#?

Go to → Solution explorer → Right click on your project → Properties. One Project window will display like below. Click on application tab and set your application name icon etc.

What are .NET executables?

NET Executable is one of the profilee types that JustTrace enables you to choose from. . NET Executable profilee type allows you to profile an application on the local computer by selecting its executable file.


2 Answers

Yes, you can use the ILMerge tool. It is also available as a NuGet package.

like image 118
mattlant Avatar answered Oct 26 '22 01:10

mattlant


Today, in 2015, you can use Costura.Fody for this. Using it amounts to adding the NuGet package to your project and recompiling. I'm not sure if it works with Visual Studio 2005 as in the question, but then it's not year 2008 either. I've used it in a few of my projects and it worked great.

Fody is a general purpose Code Weaver that is free and open source. The basic idea that it allows post-processing of the compiled .NET code to enhance it with features. For example, logging can be added to every method call, etc. In our case, it's packaging the dependent DLL files into the assembly resources, so that they could be loaded during the program runtime as if they were stand-alone dependencies.

like image 40
Andrew Savinykh Avatar answered Oct 26 '22 02:10

Andrew Savinykh