I have noticed that both dll and exe files with the name of the project are created on Windows when compiling a .NET Core console application. Why is that? In full .Net framework only the exe file would be created.
Difference between exe and dll-1. EXE is an extension used for executable files while DLL is the extension for a dynamic link library. 2.An EXE file can be run independently while a DLL is used by other applications. 3.An EXE file defines an entry point while a DLL does not.
How To Create EXE For .Net Core Console Application 1 Create a .NET Core Console application and click on the OK button. ... 2 Build the solution and open the corresponding folder just like in the below image. ... 3 Open your command prompt and go to that folder where your application persists. ... More items...
DLL (Dynamic Link Library) In .NET Framework when we compile a Console Application or a Windows Application, it generates EXE, whereas when we compile a Class Library Project or ASP.NET web application, then it generates DLL. In.NET framework, both EXE and DLL are called assemblies. Understanding DLL and EXE in .NET Framework:
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. You will get this output: 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: Which will produce an EXE:
This executable simply runs your application which is stored inside the DLL file (the DLL file may be executed directly via dotnet full_generated_dll_path ). I guess .exe output is convenient in services / daemon scenarios. The project usually has some dependencies (both managed and unmanaged), so the output contains a lot of DLL files.
Prior to .Net Core 3.0, only the dll
was created (although you could still do a single file build that was platform-dependent). In these cases you had to use the command dotnet MyProject.dll
to start your program.
With .Net Core 3.0, they added the exe
, which is still really just a wrapper around the command above. On other operating systems it also creates an executable file, it just names it MyProject
instead of MyProject.exe
If people have old scripts that still make the dotnet command, this setup doesn't break them, but if you want to just use an exe
, you can do that too.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With