RBT
RBT

Reputation: 25897

How does a .NET Core console project runs on windows OS without *.exe file?

I've created a simple .NET core console app targeting .NET Core Framework 1.1. When I build it, it creates an assembly file named DotNetCoreConsoleApp.dll in the \bin\debug folder. So there is nothing that I can double click and run directly but interestingly when I start debugging the project by pressing F5 then Visual Studio is able to launch a process.

Project configuration of my project is as below:

enter image description here

How windows will be able to launch such an application process without any exe file? I understand that Windows only understands a file as starting point of a process if it contains PE header.

Upvotes: 2

Views: 2798

Answers (1)

Ronald Meijboom
Ronald Meijboom

Reputation: 1564

There is no exe file.

From msdn: "Short answer, there isn’t one. When you compile your .NET Core console application for example, you get a DLL. Then you execute it using the DOTNET command from the .NET Core SDK found here."

From a different answer on stackoverflow (Visual Studio 2017 missing exe file): You have two options:

  1. If you want an EXE, you need to target the .NET Framework.
  2. If you don't want to change your code, then you need to install .NET Core on the server and run dotnet pathToDll on a command line

https://blogs.msdn.microsoft.com/benjaminperkins/2017/03/07/net-core-application-where-is-my-exe-how-to-publish/

Upvotes: 8

Related Questions