Birthday Sale! Up to 40% off unlimited courses & creative assets Birthday Sale! Save up to 40%!
by
Lessons:20Length:2.3 hours
Asp designers1
  • Overview
  • Transcript

3.2 Creating an MVC Project

Hello, and welcome back to ASP.NET MVC For Designers. In this lesson, we're going to create our first MVC project in Visual Studio, and there are two ways to do that. Now, either way we choose, we're gonna start by going to File, New, and Project. We're gonna create a new project, not a new website, but a new project. In the New Project dialogue we have a few options to choose from. So if we collapse this, you'll see we have Recent, Installed, and Online. We'll want to choose one of the installed options. And then you'll notice inside that we have templates and inside that we have visual C#. So, I'm gonna choose Visual C# and from the list on the right I'm gonna choose ASP.NET Web application. And over here on the right I'm gonna uncheck this option to add application insights to project. I'm not gonna worry about that for now. That would add some more items to the project itself and I wanna keep this project as simple and streamlined as possible, so I'm gonna turn that off. You can search more about that online if you're curious, but for this particular project I'm gonna turn that off. Next thing I'm gonna do is I'm going to name our project, and we're just going to call this Store, and then we'll choose a location for it. So I'm gonna click on Browse, and in the ProjectFiles folder, I'm going to create a new folder called Store01. And you can download this ProjectFiles folder for this course and this particular project will be saved in Store01, and I'm gonna save numerous versions of this as we move along so that you can follow along with your own files. But again, we're gonna save this in Store01, so we'll click on Select Folder and now we'll just double check everything. We've got our name, which is store, and we're saving it in the folder Store01 in our ProjectFiles folder. Now there's an option over here to create a directory for the solution. If we check that, then it's gonna create another directory inside the directory that we chose, and here we chose store01, and it's gonna give that directory the same name as your project, which in our case is Store. So if we checked this, it would create a directory called Store inside Store01, and I don't really need that, so I'm gonna leave that unchecked. And I'm also gonna leave Add to Source Control unchecked. Then I'll click on OK. Now, this is where we have two different options for creating an MVC site. The most obvious option is this MVC template here. When we choose this particular template, then Visual Studio will create a number of default files for us. It will create a home controller, for example, along with a couple of views. So it will put some default files in there that we might or might not need. So, I don't want to choose that particular route. I just wanted to point out that it was there. The route I want to choose is I want to create an empty project and then down here where it says Add folders and core references for I wanna make sure that MVC is checked. That way it still constructs it as an MVC project, but it's not gonna create any default controllers or views for us. So let's click on OK, and it will create the project for us. And over here on the right, we can see the structure for our project. So we have our Models folder, our Views folder, and our Controllers folder which are all empty. Now you'll notice the Views folder does have something in it. It was a web.config file in it, but it doesn't have any actual views in it just yet. We're gonna create those on our own. But that's how you can create an MVC project in Visual Studio. Thank you for watching, and I'll see you in the next lesson.

Back to the top