How To Create An Application In Asp.Net MVC With Razor Engine In Visual Studio




First of all, On Visual Studio Click on File --> New --> Project. A new window will open as shown below.

How To Create An Application In Asp.Net MVC Razor In Visual Studio, Create An Application In Asp.Net MVC, Application In Asp.Net Razor Engine MVC, Create An Application In Asp.Net MVC In Visual Studio, Asp.Net MVC, Razor Engine, WCF, Asp.Net

Select Web -- > Asp.Net MVC 4 Web Application. Rename the project with a suitable name and click OK Button. This will open a new window as shown below.

Create An Application In Asp.Net MVC Razor In Visual Studio

Select Empty Project --> Razor View Engine --> Create Unit Test --> OK Button. This will open a new Asp.Net MVC Project with Unit Test as shown below.

How To Create An Application In Asp.Net MVC Razor In Visual Studio, Create An Application In Asp.Net MVC, Application In Asp.Net Razor Engine MVC, Create An Application In Asp.Net MVC In Visual Studio, Asp.Net MVC, Razor Engine, WCF, Asp.Net




On Solution Explorer, Right Click on the Controllers Folder. Now Select Add --> Controller. This will open a window as shown below.

Create An Application In Asp.Net MVC Razor In Visual Studio

Here Name the Controller with a preffered Name. On the Template Section, select Empty MVC Controller. Now click the Add Button for adding the Controller to the Solution. If you open the newly added Controller, you can see one ActionResult with name Index. Right Click inside Index ActionResult and Select Add View Link.
This will open a new window as shown below.

How To Create An Application In Asp.Net MVC Razor In Visual Studio, Create An Application In Asp.Net MVC, Application In Asp.Net Razor Engine MVC, Create An Application In Asp.Net MVC In Visual Studio, Asp.Net MVC, Razor Engine, WCF, Asp.Net


Now give a Name for the View on the View Name section. Here the name given for the View is Index. On View Engine Section, select Razor Engine. For creating a Strongly Typed View, Select one class from Model Class. For Creating the Partial View, select Create as a Partial View checkbox.

Select Use a Layout or Master Page, if you already have a template. Now Click on the Add Button for adding the View to the Views Folder. Here we have added a View for the ActionResult Index of Controller Home. Hence there will be a folder with name Home inside Views Folder.

Inside Home Folder the newly created Index View will be added. Now open the Index View, and add HTML part on it. After Saving the View, its time to Run the Application.v The URL should be Controller/Action Name. Here it is Home/Index, you will get the Webpage. By this way we can Create An Application In Asp.Net MVC Razor Engine.