Tuesday, January 8, 2019

Deploying .Net Core using command line tools

We saw that .Net Core offers 2 types of deployment framework-dependent deployment and self-contained deployment. In the post we shall see on how to deploy a simple console applications using the command line (CLI) tools.

Let us takes the simple Hello World console application, and try to create a deployment package for the application. 



First open a command prompt and navigate to the folder path of the sample application. Before we create the package let us run the build command to build the project files, this will make sure that there are no code errors in the Project.

dotnet build



Now the project is built and is ready to be packaged. Since this is a simple console application there are no 3rd part dependent library/packages to be bundled with the deployment, hence we can run the publish command right away.

\HelloConsole>dotnet publish -f netcoreapp2.2

along with the publish command we specify the –f switch and specify the target version of .Net Core for which the application is to be packaged. This will create a /publish folder inside the projects /bin folder and place the deployment files in the /publish folder.


Search Flipkart Products:
Flipkart.com

No comments: