Creating a Project Using Visual Studio3:38 with James Churchill
In this video, we'll use the full version of Visual Studio on Windows to create an ASP.NET Core project.
Everything that we did from the command line and 0:00 Visual Studio code, a MAC OS works equally as well on Windows and Linux. 0:02 While we can use those tools to develop asp.net core apps. 0:08 It's certainly not our only choice. 0:12 Let's see how we can use the full version of Visual Studio on Windows 0:14 to create an asp.net core project. 0:18 I'll click on the new project link here on the Visual Studio start page 0:21 to open the new project dialog. 0:24 You can click on a web here on the left to filter the list 0:27 to the web specific templates. 0:31 We have two ASP.NET Core web application templates to choose from. 0:33 One that targets .NET Core and another that targets the full .NET framework. 0:38 I'll select the .NET core template and click OK. 0:43 This takes us to the second step in the process. 0:48 Where we can select the specific ASP.NET core template that we want to use. 0:51 I'll select the web application template and click OK. 0:56 And here's our project. 1:05 As soon as Visual Studio finishes creating our project we can see here in 1:11 Solution Explorer that Visual Studio is busy restoring the packages for 1:16 apps dependencies. 1:20 Let's open the project JSON file and review the list of our apps dependencies. 1:24 As you can see our NVC webapp 1:32 has a lot more dependencies than our simple webapp from the previous video. 1:35 There are packages related to diagnostics. 1:39 NVC, razor, routing, I.I.S. integration, 1:42 static files, configuration, logging and browser link. 1:48 In the next video we'll see how we are using middleware components from these 1:54 packages to build up our request pipeline. 1:57 Now let's build our app. 2:01 In the output window, we can see that Visual Studio is using the same .NET build 2:12 command that we were using from the command line. 2:16 Let's take a quick look at the program.cs file. 2:21 The UseContentRoot method tells us the host to use the current directory as 2:30 the root of the application. 2:35 It's important to note that the root of our application is not the same 2:37 as the webroot which is the dub, dub, dub root folder in our project 2:41 the web root is the location of the serviceable web content. 2:45 Being able to specify separate application and 2:49 web routes is a nice improvement over the previous version of ASP .NET. 2:52 The use IIS integration method configures the host so 2:57 our web app can be integrated with IIS. 3:00 This is necessary so that we can use IIS express as our development server 3:03 when using the full version of Visual Studio. 3:08 The big difference here from our earlier web app is that instead of configuring our 3:12 application within the program .cs file, we're using the you startup 3:16 method to configure the host to use a startup class of type startup. 3:21 Moving all of our app configuration code 3:27 into its own class makes our host configuration code much more focused. 3:30 After the break we'll take a look at the startup class. 3:35
You need to sign up for Treehouse in order to download course files.Sign up