• Understanding ASP.NET Core Project Structure and File Structure

    by  • February 14, 2017 • .NET Core, ASP.NET Core • 0 Comments

    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.

    How asp.net core project strucure looks in visual studio

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

    How asp.net core solution looks on the file system How asp.net core project structure looks on the file systemNow 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.

    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.

    Web.Config File

    Startup.cs File

    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.

     




    Namecheap.com
    Avatar of admin

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply