Jon Gallant

How to Create a .NET Core CLI Console App as an EXE Instead of a DLL

1 min read

You may have just discovered that when you create a console app using the .NET Core CLI tools it only produces a DLL by default.

If you execute this:

Terminal window
dotnet new console -n App
```text
And then execute a build
```bash
dotnet build
```text
You will get this output:
![000294](/images/dotnet-core-console-app-create-exe-instead-of-dll/000294.png)
It took me a while to figure this out, but in order to generate an EXE instead of a DLL, you need to pass a ‘runtime’ to the build command, like this:
```bash
dotnet build -r win10-x64

Which will produce an EXE:

000296

List of valid runtimes (RIDs) can be found here: https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#using-rids

Jon

Share:
Share on X