Tech Junkie Blog - Real World Tutorials, Happy Coding!: Hour 1: Create ASP.NET Core Project From Scratch

Monday, July 22, 2019

Hour 1: Create ASP.NET Core Project From Scratch

Technology has moved at a breakneck speed, after working with ASP.NET Core for a while, I realized that my ASP.NET MVC blog articles have become outdated.  Don't get me wrong, MVC is still a very big part of ASP.NET Core, but that's the thing it's just a part of it.  ASP.NET Core has decoupled the infrastructure from the application.  You can deploy your web app on Docker imagine that!  No longer is IIS your primary means of hosting your ASP.NET application.

However, with this new freedom comes added complexity.  No longer can you just drag and drop components into your design surface.  Those days are long gone.  This post ist meant to ease your way into ASP.NET Core.  I will using the release candidate version two of ASP.NET Core for this post and other subsequent posts.  I found out that I can't really follow my blog posts anymore to create the project with the latest version which is 2.1.  Don't use 2.2 for now because there's still not a lot of documentation on it.  So here is the updated version  I will be using Visual Studio 2017 for my development.  You can use the command line interface and notepad to develop your ASP.NET Core application.  But, I think that borders on insanity.

So let's begin our journey together!

Here are the steps to create an ASP.NET Core application from scratch:

1. Create an empty Visual Studio solution File → New → Project v Other Project Types → Visual Studio Solutions → Blank Solution.  In the name field call the solution "NorthwindCafe" then press "OK"

2.  Now that we have the blank solution we can add the ASP.NET Core project, right click on the "NorthwindCafe" solution, then select "Add" → New Project →  Visual C# → ASP.NET Core Web Application .  In the "Name" field give it the name "NorthwindCafe.Web" then click "OK"

3.  On the "Select a template" screen select "Empty", leave the drop down to .NET Core, and ASP.NET Core 2.1,  also uncheck the "Configure for HTTPS", then click "OK".  Make sure you select ASP.NET Core 2.1 because there's still some issues with ASP.NET Core 2.2

4.  After you click "OK" you will see the following folder structure for your project.  As you can see it's very bare bones to start with.  The first thing you will notice is that there is a "wwwroot" folder this is where you will server up your static files.

If you press Ctrl+F5 to run the application you will see "Hello World"

5.  Although it's just a string output if you look at the Startup.cs file

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
            if (env.IsDevelopment())

            app.Run(async (context) =>
                await context.Response.WriteAsync("Hello World!");

1 comment:

Search This Blog