Here is the link to the "home page" for this blog series.

We start with Azure DevOps and create a project called DotNetCore. How to create an Azure DevOps project you can read here. My project will be public, take a look. Create repo called MyVeryFirstAPI. Get the code by using Visual Studio or your favorite git tool. I prefer command line, navigate to your folder where you want to store your code (mine is C:\blog\azureDevOps\DotNetCore) and run git command

cd \blog\azureDevOps\DotNetCore
git clone https://[email protected]/sergeydotnet/DotNetCore/_git/MyVeryFirstAPI

When you have everything installed, open Visual Studio and click on File-> New Project... or use shortcut Ctrl+Shift+N

New Project

Choose ASP.NET Core Web Application

Also provide Name, then Location by clicking on Browse... Choose also Create directory.

Click Create.

Choose API and make sure you are using the latest .NET Core version, 5.0 is the latest when I am creating this post. Skip the Authentication part for now and docker support. Choose also Enable OpenAPI support.

Click OK.

Visual Studio generates following structure for us


Always check file explorer as well

MyVeryFirstAPI solution

Visual Studio generates MyVeryFirstAPI.sln file and the folder MyVeryFirstAPI.

Content of MyVeryFirstAPI folder looks like this

MyVeryFirstAPI project

I will write later about all this files but now you have to learn about 2 most important files: MyVeryFirstAPI.sln and MyVeryFirstAPI.csproj. *.sln file, called solution file is the file that includes all information about our application and can include many *.csproj files, called project file. When you close your Visual Studio and want to continue to work further you have to navigate to *.sln file and double click on it to open your application using Visual Studio.

Now we take a look at MyVeryFirstAPI.csproj. Right click on  MyVeryFirstAPI node in the Visual Studio

Click on Edit MyVeryFirstAPI.csproj

The file looks like this

<Project Sdk="Microsoft.NET.Sdk.Web">


    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0" NoWarn="NU1605" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="5.0.0" NoWarn="NU1605" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />


The most important things is TargetFramework node. Here you are telling which version of .NET Core you want to use. In this case we are using 5.0.

ItemGroup node is where you list all your NuGet packages. If you don't know about NuGet, you can read Microsoft documentation here. To explain it short: we, developers, don't like to reinvent the wheel and solve same problems again and again that's why we solve the problem, create a package like small application and use NuGet to store and distribute our solution to the all developers. NuGet is basically package manager for .NET application.

Good practice here always specify a Version to have control over the versioning. If you are not specifying a version, the latest NuGet package will be downloaded. The exception here is Microsoft.AspNetCore.App package. Microsoft recommend to not specify the version for this package and saying: "The Microsoft.AspNetCore.App metapackage is not a traditional package that is updated from NuGet." If you are interested check out this discussion.

If you like me and prefer to use command line and do all this steps using .NET Core command-line interface (CLI) check this post.

Now we are ready to build and run solution. Remember to keep your code under source control.

git add .
git commit -m "Initial commit"
git push

Run the application by choosing first MyVeryFirstAPI, in the dropdown

and click F5 or go to Debug->Start Debugging

Start Debugging

The output looks like this in the browser

Here is the link to the "home page" for this blog series.

Let me know in the comments if you experienced any troubles or if you have any feedbacks. Don't forget to subscribe to get news from Sergey .NET directly to your mailbox.

Get started with .NET Core

My public Azure DevOps repo for this post

Create a new project Azure DevOps

An introduction to NuGet

Discussion for the Microsoft.AspNetCore.App implicit version