Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create an EXE file from C# using Windows Forms?

Tags:

c#

winforms

I have a simple Windows Forms project in C#.

I want to be able to turn this into an EXE file to be able to give this out to some of my friends. I am using Visual Studio 2019.

Before you say that there is an application file in the bin/debug folder, yes, I know that. The thing is that I want to be able to create this into just one file where they won't be able to access the code.

like image 447
Babar Ali Avatar asked Apr 12 '26 19:04

Babar Ali


1 Answers

If you want a 100% portable application :

  1. Install the Nuget Package Costura.Fody. It will add all the dependencies directly into the .exe so that there are no separate .dlls or other files apart from it.

    costura

  2. Change the output to Release and generate your project (run it or CTRL + B)

    release

  3. Go to your project folder / bin / release and there is the .exe

  4. Profit.

like image 68
UserNam3 Avatar answered Apr 15 '26 08:04

UserNam3



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!