ASP.NET Core Project Structure

In the previous chapter, we created our first ASP.NET Core 2.0 web application. Here, you will learn about the project structure and significance of each file created by ASP.NET Core application template in Visual Studio 2017.

The following is a default project structure when you create an empty ASP.NET Core application in Visual Studio.

ASP.NET Core Project Structure

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.

Solution Explorer - Folder View
Note:
ASP.NET Core project files and folders are synchronized with physical files and folders. If you add a new file or folder in project folder then it will directly reflect in the solution explorer. You don't need to add it in the project explicitly by right clicking on the project.

.csproj

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.

Edit .csproj

The .csproj for the above project looks like below.

Edit .csproj

The csproj file includes settings related to targeted .NET Frameworks, project folders, NuGet package references etc.

Dependencies

The Dependencies in the ASP.NET Core 2.0 project contain all the installed server-side NuGet packages as well as client-side frameworks such as jQuery, AngularJS, Bootstrap etc. These client-side dependencies are managed using Bower in Visual Studio.

Dependencies

As you can see above, dependencies node in solution explorer displays installed NuGet packages. This also includes bower folder which has all the client-side frameworks library installed it using Bower.

Properties

The Properties node includes launchSettings.json file which includes Visual Studio profiles of debug settings. The following is a default launchSettings.json file.

launchSettings.json

We can also edit settings from the debug tab of project properties. Right click on the project -> select Properties -> click Debug tab.

Project Properties

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.