---
title: "How to Build a .NET Core console application to output in an EXE?"  
description: "How to Build a .NET Core console application to output in an EXE?"  
author: "Utpal Vishwas"  
published: 2023-07-06  
updated: 2023-07-07  
canonical: https://www.mindstick.com/forum/158971/how-to-build-a-dot-net-core-console-application-to-output-in-an-exe  
category: ".net core"  
tags: ["asp.net", "asp.net core", ".net core"]  
reading_time: 2 minutes  

---

# How to Build a .NET Core console application to output in an EXE?

How to Build a .NET Core [console application](https://www.mindstick.com/forum/160510/how-to-fetch-data-from-the-database-in-the-dot-net-console-application-using-c-sharp) to [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular) in an [EXE](https://answers.mindstick.com/qa/31267/what-is-exe-file)?

## Replies

### Reply by Aryan Kumar

Sure. Here is how to build a .NET Core [console](https://www.mindstick.com/blog/210/the-console-class) [application](https://www.mindstick.com/articles/12824/calculator-application-in-android) to output in an exe:

1. Create a new .NET Core console application project.
2. In the project's directory, run the following command:

Code snippet

```plaintext
dotnet build -c Release -o bin/Release/netcoreapp3.1
```

This will build the application and output an exe file in the `bin/Release/netcoreapp3.1` directory.

1. Run the exe file by double-clicking on it or by running the following command in a command prompt:

Code snippet

```plaintext
dotnet bin/Release/netcoreapp3.1/myapp.exe
```

This will run the application and output the results to the console.

Here is an example of a .NET Core console application that outputs the text "Hello, world!" to the console:

C#

```plaintext
using System;

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, world!");
        }
    }
}
```

To build this application and output an exe file, you can run the following commands:

Code snippet

```plaintext
dotnet new console -o HelloWorld
dotnet build -c Release -o bin/Release/netcoreapp3.1
dotnet bin/Release/netcoreapp3.1/HelloWorld.exe
```

This will build the application, output an exe file in the `bin/Release/netcoreapp3.1` directory, and then run the application. The text "Hello, world!" will be output to the console.


---

Original Source: https://www.mindstick.com/forum/158971/how-to-build-a-dot-net-core-console-application-to-output-in-an-exe

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
