This is the continuation of our second article, “Getting started with .NET Core with Windows and Visual Studio 2015 – Part 2”.
Preview
In this article, we will learn how to create a deployment package for console applications created using the .NET Core.
First, let's understand the various types of deployment, which we can create using .NET Core.
We can create two types of deployment packages for .NET Core applications.
- Framework-Dependent deployment (FDD)
- Self-Contained deployment (SCD).
Let’s start with Framework-Dependent deployment.
- Deployment of .NET Core application using Framework-Dependent deployment (FDD) approach
We will use term FDD to represent “Framework-Dependent deployment”. The name suggests its traditional way of creating the solution files.
As we have already installed the respective .NET Framework on the server, our published files of the application will be using the installed version of the framework and running the application.
To make things simple, we will use the same application that we have created in our previous article. So, if you remember we have created the following two applications, using .NET Core framework.
- DotNetCoreDemo (.NET Core Class Library )
- DotNetCoreApp (.NET Core Console application)
We will publish the “DotNetCoreApp” Application, using FDD approach.
Step 1
Create the publish type
Right click on the project with the name “DotNetCoreApp” and click "Publish".
You will get the modal popup with a header “Publish”. Select the “File System”.
Step 2
Create the Profile and deployment folder
You will get the popup to add the profile name. Give the name as “DotNetCorePublish” click OK.
Now, we have to select the folder name where we need to create deployment files.
I have created a folder with the name “Test” under the D: Drive. Select the folder and click “Next” button.
Step 3
Select the additional settings
Now, you will get to the "Settings" tab. Leave all the options as they are. Expand only the “File Publish Option” and select the option “Delete all the existing files prior to publish”. This option will clear all the previously created files. This will make your deployment folder neat and clean with a fresh set of the files.
Step 4
Publish the application
Now, click "Publish" button. Your application should publish the files successfully.
We have now published the very traditional way, which we used to do on .NET Framework.
Let’s have a look at the folder that contains our published code.
These are the only set of the files generated, using FDD approach.
Now, if you have a closer look, there is no .EXE file. In traditional .NET framework, whenever you create any console application, you will get .EXE file, where you can double click and run the application.
If you want to know why we didn’t get .EXE file, you can go through the
information.
We have learned how to publish .NET Core console application using FDD (Framework-dependent deployment) approach.
To make things short and simple, we will learn more about SCD (Self-contained deployment) approach in the next article.