Publishing ASP.NET MVC Application Using File System

In my previous few articles we have learned how to create ASP.NET MVC web application, Now in this article, we will learn how to publish ASP.NET MVC Applications, using File system method, Let's start step by step, so beginners can also understand .
What is Publishing ?
Publishing is the process to make an application code suitable to host on the Server by merging multiple class codes into DLLs and by keeping only the required UI code .
The web application goes through the following standard procedure before hosting to the Server.
  • Developing an application 
  • Publishing an application
  • Hosting an application on IIS
Now, let's demonstrate the preceding concept step by step; i.e, how to publish ASP.NET Web MVC applications practically.
Step 1: Create ASP.NET MVC application
If you want to publish any application, first we need to create the Application. If you don't know how to create ASP.NET MVC application, Please refer to my previous articles and Video tutorials by using following links,
 Watch video which explains how to create ASP.NET MVC application step by step


Step 2: Publish an Application
Right click on the created ASP.NET MVC application, as shown below.


Now, click the previously shown Publish option. It will open the Windows, mentioned below.
Step 3: Select Publish Target
Now, select the option, where you want to save the published code. There are lots of options given by Visual Studio to save the published code , as shown below.



In the preceding image, we have seen that there are many options listed to publish the application, let's learn about them in brief.
  • Microsoft Azure App Service 
This is one of the services provided by Microsoft Azure to publish the different types of the Application such as Web, mobile, REST and other into Azure (Cloud). You need a Microsoft Azure subscription to use this option.
  • Import 
This option is used to publish the application, which is based on the predefined configuration files given by your hosting provider , which will directly publish the files in your hosting provider environment.
  • Custom
This option is used to publish the Application into your own machine location or FTP Server, as per your most convenient way.
  • Microsoft Azure API apps 
This option is used to publish REST API's Services in Cloud.
  • Microsoft Azure virtual machine 
This option is used to publish the Application in Microsoft Azure virtual machine (Cloud), which requires an Azure subscription .
There are many other options to publish the Application, using which we can publish .NET application.
Step 4: Create Publish profile
Now, in this article, we are going to publish an application in our local machine file system, so we need to choose custom target option. First, we need to create the profile to publish the application, so it can be a consistent setting to publish the same application in the future. Choose custom option from preceding explained target option, as shown below.


Now, give the profile name as per your requirement and click ok. It will create the custom profile, as per your given name.
Step 5: Choose Publish Method
Now, configure the created profile, which decides where and how to publish the code. Select the publish method from the number of options, which are shown below.



Now, choose the file system method from preceding methods and click Next button.
Step 6: Choose File System Location
Now, choose the target location of your local system in which you want to store the published code, as shown below.



In the preceding screenshot, we have selected the target location E drive to store the published code. It may be different in your case, as per you machine, No click Next button .

Step 7: Choose Publish code type
Now, choose what type of code you want in production environment by choosing release or debug option, as shown below.


Now, let's learn in brief about debug and release option.
  • Debug: Choose this option when you want to debug your application after the hosting.
  • Release: Choose this option when you do not want to debug the Application after hosting and make the application faster . 
Step 8: Preview the configuration
After the configuration, publish configuration tool will look like, as shown below.



Now, click Publish option and watch the output Window, as shown below.


Now, as shown in the preceding screenshot's highlighted section, our application code is published in our specified file system location. Now, navigate to the target folder and see the published code and files as shown below.


Preceding is our published code, which is used to host in IIS. I hope from all the preceding examples, we learned how to publish ASP.NET MVC application in File system .
Note
  • Choose the publish target location, as per your system.
  • Select proper publish method, as per your requirement.
  • These Publish steps are different in Visual Studio 2017
Summary
I hope, this article is useful for all the readers. If you have any suggestions, please contact me.

Don't Forget To 

Post a Comment

www.CodeNirvana.in

Protected by Copyscape Online Copyright Protection
Copyright © Compile Mode