Create a new project

- [Instructor] In the previous video, I introduced you to the high-level concepts behind ASP.NET Core and ASP.NET Core MVC. In this video, we'll finally see ASP.NET Core MVC in action as I show you how to use Visual Studio to create your very first ASP.NET Core MVC application. As with any new Visual Studio project, we start with File, New Project. Then we can choose the ASP.NET Core Web Application project type and give our project any name we like. Throughout this course, I'll be converting the Explore California site that I showed in the last chapter, so I'm going to name my project ExploreCalifornia. You can feel free to put it anywhere you like on your machine or just leave the default location and leave all the other settings alone too. There is a second step to creating the ASP.NET Core Web Application and that is to decide what kind of web application we'll be building. Before you continue, make sure that you selected ASP.NET Core 2.2 or above from the list of frameworks in this dropdown. If you do not see .NET Core 2.2. or above as an option in the list, try to rerun the Visual Studio installer or reinstall the SDK as I show in the Development Environment Setup video from the previous chapter. Now you're ready to choose your template. We've got a handful of ASP.NET Core templates to choose from but there are two that are most relevant to us and they are the Web Application Model View Controller template. This is a fully functional ASP.NET Core MVC application complete with data access and membership services, all pre-configured and ready to go. The second one we're interested in is the Empty template which is a bare bones template with just the very basic files and recommended layout to get us started with building our application. Since I think the best way to learn a new framework is to implement everything by hand, I'm going to be starting with the Empty template. However, once you've finished with this course, you'll probably want to choose the Web Application Model View Controller template to skip all this low-level stuff I'm going to show you next and get your projects up and running quickly. So, for now, go ahead and choose the Empty template and make sure that the Configure for HTTPS option is unchecked since that will involve additional configuration. Then go ahead and click OK to continue and wait while Visual Studio sets everything up. After a couple seconds, Visual Studio will let you know it's done by opening up this Welcome page with a bunch of helpful links to help you learn more about the various aspects of developing ASP.NET Core applications. However, for now you can just go ahead and close this page. After you close the Welcome page, you'll be greeted with the Startup class. This is the entry point of your ASP.NET Core application and currently the only code that's running on our site. The ASP.NET Core team has added some default code to the Startup class to demonstrate the most basic form of handling a web request by responding with hard coded text, Hello World. Since this code is already in place, let's just go ahead and execute the application to see it in action by hitting Control + F5 to run the site without the debugger attached. Like any other Visual Studio web application you've used in the past, Visual Studio will execute the site in IIS Express and open the site up in a browser so that we can see the result. And there it is, the message we saw in the Startup class. Hello World. Congratulations, you've created and executed your first ASP.NET Core web application. Before you close the browser and move on, however, let's try this. Switch back to Visual Studio, and change the message in the string to say something else like Hello ASP.NET Core. Then just save the file, switch back to the browser and reload to see your change. Notice that we never had to rebuild our application. All we had to do was save the C# file and ASP.NET Core dynamically recompiled the site for us automatically. That's your first taste of one of the nice new development productivity features that ASP.NET Core introduces. When you're done playing around with the code, go ahead and close the browser, head back into Visual Studio and move onto the next video where I'll show you how to respond to web requests with more than just hard coded text.

Resume Transcript Auto-Scroll

Author

Updated

5/3/2019

Released

12/6/2016

ASP.NET Core, the Microsoft web development framework, includes an optimized developer experience, better performing runtime, and cross-platform support for Windows, Mac, and Linux. In this course, Jess Chadwick introduces the basics to get you up and running with ASP.NET Core, and creating your own professional quality applications. He explores setup and installation, working with the ASP.NET Core framework, and the techniques you need to manage data, reuse code, construct web APIs, and secure your new applications. All of this is included along with industry-standard best practices such as dependency injection and the model-view-controller pattern for more modular code.