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

Time:09-13

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.

CodePudding user response:

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.

CodePudding user response:

Right click on your project in Solution Explorer, then Publish... If it is .Net Core project, you'll get your .exe in the indicated folder. You can also chceck folder: ProjectName/bin/Debug(or Release)/netcoreapp(or netframework)/.exe should be there.

You may be interested in this link: https://docs.microsoft.com/en-us/visualstudio/deployment/publish-overview?view=vs-2022

  • Related