Main menu

In this post, we’re going to understand the project structure of an ASP.NET Core project. We have created a simple project with an empty template to see how a simplest ASP.NET Core project structure looks like both inside Visual Studio and on file system. This way, we can see how the files are organized and what the each file do.

Let’s first see how an ASP.NET Core Project Structure looks like inside Visual Studio.

And if you view this solution and the ASP.NET Core project on the file system, you can see the following:

Now we’ll see what each file does. First, we need to look at global.json file. This is a JSON (JavaScript Object Notation) file. It contains the information about the projects being used in this solution along with the .NET Core SDK version.

1

2

3

4

5

6

{

"projects":["src","test"],

"sdk":{

"version":"1.0.0-preview2-003131"

}

}

In new ASP.NET Core, the file system determines what’s included in the ASP.NET Core project. So whatever you add on the file system inside this folder structure will be depicted in the visual studio solution. Project.json file is specific to a particular project and contains information specific to that project including dependencies, frameworks and other options.

You do not need to build an ASP.NET Core project from the visual studio, instead you only need to run the web server from the Visual Studio and the app should work fine without building the project. The ASP.NET Core project also contains the web.config file to manage configurations and startup.cs file which is something similar to the global.asax file in older ASP.NET. This is how both of these files look like.

If you run this default ASP.NET Core project with empty template, you’ll see Hello World! as an output, which is being rendered from the Configure method of the Startup.cs file. This method handles the HTTP processing pipeline and all the HTTP requests are served through this page.