I am going to create ASP.NET MVC Project in Visual Studio 2019. It contain all the features you need to create, test and deploy dot Net Framework application. We will create a simple application in which I will cover the basic structure of ASP.NET MVC application.
Subscribe YouTube For More Videos | Video is in Hindi – URDU
When you will open Visual Studio Visual Studio 2019 you have to view a following alike screen.
In which you can see two parts, the left one will show list of project in which you have recently worked. In the right panel you can see built in options to create, clone, open project and solution.
We have to click on “Create a new project”.
A new screen appears in which you have to select which type of application you want to create. Because in the previous step you didn’t selected the type so you must have to define what you want to develop.
I have recently used to developed “ASP.NET Core Web Application Project” that’s why it’s appearing in the left panel. But we are covering MVC project so we have to select that.
Just scroll down and search for the “ASP.NET Web Application (.NET Framework)” and clicked on next button.
A new screen appears in which you have to define the name of your project & the location where you want to reserve the application files. Even that you can also select the “.NET Framwork Version”. I’m just going to change the name of application and rest of settings remains same as above image, In the last click on create button.
Then a new screen appears in which Visual Studio 2019 will ask you about the structural type of you “ASP.NET MVC Application” and we are going to select the Empty and select MVC in core references and then click on create button.
- If you will select EMPTY, a new project is created without any default data.
- If you will select MVC, the project is created with the empty Model, View, Controller folder.
After this process of creating project is started which takes 1 to 3 minutes according the specs of your machine. I’m not attaching the image of progress bar here.
So here is the first look of your newly created ASP.NET MVC Project. We will not go in the depth of other things expect of important features which you need to know before started with project. In the right sidebar you can see folders and files. These are essentials of your project, technically we will call this right sidebar as Solution Explorer.
In which the highlighted “JunaidShahidBlog” is the name of your project. All files and folders are under this project, you can add multiple projects under the same solution (this approach is practiced by the enterprises to develop one stop solution).
Understand Files & Folders
AssemblyInfo.cs contain info regarding the assembly as the named reflecting the purpose. Such as the description, version and name etc. You can get more understanding by reading the brief comments inside file.
References have the list of the libraries which you are consuming in your application. Such as if you are using Entity Framework you will found the name in the references too.
RouteConfig is used to define the application routing. You can also get idea from the name, by default one route is defined but you can add your own custom routes as you are wanted.
Controller Folder is used to placed the controller of application, which are used to control the data flow & application.
Model Folder is used to placed the model (model classes, view model, data transfer object) of application, which are used to transfer data from database to view.
View Folder is used to placed the view (html pages) of application, which are used to visualize user interface.
Global.asax which contains the higher level events of your application such as the start event (Application_Start).
Packages.config is used maintain the packages by project references. It will allow the NuGet Package Manager to easily restore individual project dependence whenever you will migrate your solution to other servers.
Web.config file contain the essential configuration of your whole application. Your application dependencies and their versions are configured here automatically. Even that you can some custom keys to fetch their data in whole application. Somehow you can see that mostly developed used to place their database connection string in this file.
Conclusion
In this tutorial you have learned to Creating New ASP.NET MVC Project in Visual Studio 2019. You are now able to create your own projects. I have tried to explain each and essential file of project which can make you better in sense during development. If you found any flaw in my knowledge correct me because sharing is caring. If you like this piece of knowledge must share and get connect with my social circle.