ASP.NET Core - Project Structure
Here, you will learn about the project structure and significance of each file created by ASP.NET Core 2.0 application template using Visual Studio 2017.
The following is a default project structure when you create an empty ASP.NET Core application in Visual Studio.
The above solution explorer displays project solution. We can change it to folder view by clicking Solution and Folders icon and selecting Folder View option. This displays the solution explorer with all project folders and files as shown below.
ASP.NET Core 1.0 does not create .csproj file, instead, it uses .xproj and project.json files to manage the project. This has changed in ASP.NET Core 2.0. Visual Studio now uses .csproj file to manage projects. We can edit the .csproj settings by right clicking on the project and selecting Edit <project-name>.csproj as shown below.
The .csproj for the above project looks like below.
The csproj file includes settings related to targeted .NET Frameworks, project folders, NuGet package references etc.
The Dependencies in the ASP.NET Core 2.1 project contain all the installed server-side NuGet packages, as shown below.
Right click on "Dependencies" and then click "Manage NuGet Packages.." to see the installed NuGet packages, as shown below.
As you can see, it has installed three packages, Microsoft.AspNetCore.App package is for ASP.NET web application, Microsoft.AspNetCore.Razor.Design package is for Razor engine, and Microsoft.NETCore.App package is for .NET Core API.
You can install all other required server side dependencies as NuGet packages from Manage NuGte Packages window or using Package Manager Console.
The Properties node includes launchSettings.json file which includes Visual Studio profiles of debug settings. The following is a default launchSettings.json file.
We can also edit settings from the debug tab of project properties. Right click on the project -> select Properties -> click Debug tab.
In the debug tab, select a profile which you want to edit as shown above. You may change environment variables, url etc.
Learn about wwwroot in the next chapter.