Create your first .Net Core 5.0 WebApi

DotNet Core 5.0

Follow with me!

  • SDK: DotNet Core 5.0 Software Development Kit,
  • Editor: Visual Studio Code, VIM,
  • Container Builder: Podman (low footprint, no daemon needed), or in worst cases use Docker ;)

Create Solution File

dotnet new sln -n green-wave
dotnet new webapi -n green-wave
- “Startup.cs”: Contains all the settings and configurations,
- “Program.cs”: Contains the method “Main”, which is the entry point of the ASP DotNet Core application,
- “green-solution.csproj” defines what libraries are referenced,
- “green-solution/Pages” directory holds example web pages for the application.
dotnet sln green-wave.sln add ./green-wave/green-wave.csproj
dotnet new xunit -n green-wave.Test
dotnet sln green-wave.sln add ./green-wave.Test/green-wave.Test.csproj
dotnet add ./green-wave.Test/green-wave.Test.csproj reference ./green-wave/green-wave.csproj

Build/Test the Solution

dotnet build
dotnet test
dotnet run -p ./green-wave/green-wave.csproj \
--urls=http://127.0.0.1:8080
curl -k http://localhost:8000/weatherforecast?location=detroit

Publish Artifacts

dotnet publish -c Release -o publish
- "green-wave.deps.json": Application runtime dependencies file...
- "green-wave.dll": This is the framework-dependent deployment version of the application, which we're going to use as entrypoint to our application
- "green-wave.exe": Executable version
- "green-wave.runtimeconfig.json": Application's runtime configuration file (DotNet version to use)

What’s next?

Thank You for Reading Me!

Is a Cloud-Native enthusiast with 12 plus years of experience. He’s continuously immersing himself in the latest technology trends & projects.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to store off-chain data without compromising on decentralisation and immutability

#freestockphoto (Monday 30th 02PM)

MetaMetrics: A Refresher on MetaMask’s Analytics System

Create multiple IAM users using AWS CLI

The road to Andela

ASP.NET Core on AWS Elastic Beanstalk Docker image through GitHub, CodeBuild, and CodePipeline…

HOW TO BEST HANDLE BUGS IN DYNAMICS 365

Web hosting models for software development agencies

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aymen Abdelwahed

Aymen Abdelwahed

Is a Cloud-Native enthusiast with 12 plus years of experience. He’s continuously immersing himself in the latest technology trends & projects.

More from Medium

Enumerating active directory using C#

Pushing a local docker image to Amazon ECR Repository using .NET 5, C# and AWS ECR SDK

Logging gRPC on .NET Using Serilog

How to publish a NuGet package using dotnet CLI