.Net Core 2.1 produces .dll instead of .exe & RuntimeIdentifiers

hfaun 1 Reputation point

I have a .NET Core

<Project Sdk="Microsoft.NET.Sdk">

Target framework = .NET Core 2.1
Output type = Console Application

When I compile it I get a dll instead of a exe. I read a post on this forum that you should add <RuntimeIdentifiers> which I did (see below) but I still get a dll. Is .NET Core not meant for console applications or why does that not work? Also why do I need to define OSs and bitness? I though .NET anything produces bytecode which then on first execution is translated to machine code.

<ApplicationIcon />


A cross-platform toolchain for developing, building, running, and publishing .NET applications.
291 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ken Tucker 5,801 Reputation points

    Dot net core is cross platform. EXEs are a windows thing that is why dlls are created. if want an exe use publish to create it.

     dotnet publish -r win-x64 -p:PublishSingleFile=True   


    You can run the dll like this

      dotnet MyApp.dll