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

Viewed 65

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.

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.

Related