Publish like exe

How to Generate and Run an EXE from ASP.NET Core

How to Create and Run an EXE from ASP.NET Core

You can create a standalone .exe file from your ASP.NET Core project that a client can run directly — without installing .NET — by publishing it as a self-contained executable.

✅ Step-by-Step Instructions

  1. Open your command prompt or terminal.
  2. Navigate to your ASP.NET Core project folder.
  3. Run the following command to publish a self-contained EXE:
dotnet publish -c Release -r win-x64 --self-contained true -o ./publish
  • -c Release: Uses the release build configuration.
  • -r win-x64: Targets 64-bit Windows (you can change this for Linux or macOS).
  • --self-contained true: Bundles the .NET runtime into the EXE.
  • -o ./publish: Outputs the build to the publish folder.

๐Ÿ“ After Publishing

Navigate to the publish folder. You will find an EXE file, like:

YourApp.exe

▶️ How to Run It

You can either double-click the EXE file or run it from the terminal:

cd publish
YourApp.exe

This will launch the ASP.NET Core app using the Kestrel server, typically accessible at:

http://localhost:5000

๐Ÿ“ Notes

  • Make sure no firewall is blocking port 5000.
  • This works for Web APIs or Razor Pages/Blazor Server projects.
  • Optional: Include a .bat file to simplify launching for non-technical users.

๐Ÿ“ฆ Bonus: Creating a Batch Launcher

Create a file named launch.bat in the publish folder:

@echo off
start YourApp.exe
pause

Now the client can just double-click launch.bat to start your app!

That's it! You've created a distributable EXE version of your ASP.NET Core project.

Comments

Popular posts from this blog

(New Job Model ) ATC_RJE _SDM

เค†เคˆเคŸी เคชेเคถेเคตเคฐ เค…เคฌ เคฌेंเค—เคฒुเคฐु เค›ोเคก़เคจे เค”เคฐ เคฎुंเคฌเคˆ เค•े เคชाเคธ เคจैเคจा เคธिเคŸी เคฎें เคฌเคธเคจे เคชเคฐ เคตिเคšाเคฐ เค•เคฐ เคฐเคนे เคนैं।