Thursday, October 1, 2020

Creating Executable from .Net Core Application

.Net Core applications by default will create .dll executables, in this post we shall see how to explicitly create a .exe using .Net Core, in the next post we will see how to use this .Exe and create a Docker image. 
Let’s start by creating a .Net Core Console App using Visual Studio.
When you build the application you can see that it does not create an .exe file, instead it creates a .dll file HelloExe.dll. In .Net Framework console applications will create a .exe file but not any more in .Net Core

To create an .exe file we need to publish the project, either using a command or using Visual Studio
We can use the following commands

HelloExe>dotnet publish -c Debug -r win10-x64

Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 162.06 ms for C:\HelloExe\HelloExe.csproj.
  HelloExe -> C:\\HelloExe\bin\Debug\netcoreapp3.1\win10-x64\HelloExe.dll
  HelloExe -> C: \HelloExe\bin\Debug\netcoreapp3.1\win10-x64\publish\

Now the .exe file will be created in the target folder, we can test the exe by invoking it from the command prompt as follows.
C:\HelloExe\bin\Debug\netcoreapp3.1\win10-x64>HelloExe.exe
Hello World from .Net Core

To create the .exe in Release mode we can use the command.
HelloExe>dotnet publish -c Release -r win10-x64

Alternatively, we can publish the .exe from Visual Studio also.
Right-click the project and select Publish
Choose the Folder publish option and select a target folder to publish. Configure Publish settings as follows.

Once configured, click on Publish
This will build and publish the HelloExe.exe file as follows.





Search Flipkart Products:
Flipkart.com

1 comment:

Anonymous said...

How to play online casino with your friends - FEBCASINO.COM
Casino games will usually have lower odds, however, this means you should try to keep your bets 제왕카지노 in mind before playing febcasino at the 메리트 카지노 쿠폰 online casino.