How to create a Web App and Console App in C#

Web App A web app (web application) is a software application that runs in a web browser instead of being installed on a computer or mobile device. It is built using web technologies like HTML, CSS, JavaScript, and backend languages such as C# (ASP.NET), Python (Django/Flask), PHP, or Node.js. Console App A console application is a simple program that runs in a command-line interface (CLI) like the Windows Command Prompt or Linux Terminal. Unlike web apps, console apps do not have a graphical user interface (GUI); instead, they rely on text-based input and output. VS code Visual Studio Code (VS Code) is a lightweight code editor that supports C# development through extensions. Below is a step-by-step guide to setting up and creating a C# Console Application and web application in VS Code.So to create a Web App and Console App we need to download VS code, install C# AND .NET.SDK. Steps to creating Web App and Console App in VS code. Step 1 Go to your browser ,type VS code, click on Visual Studio Code and download base on your Operating system.Click on the download and run it to install it on your computer. Step 2 On your VS code, click on Extension Tab,in the search field, type in C# Dev Kit and install it.N/B Dev.kit helps you to install some certain things in the background Step 3 Click on View and click on Command pallet.Type in Install new .NET SDK.click on Install .NET SDK .Wait for it to install ,after which you reload the window.You can download it manually through this link.https://dotnet.microsoft.com/enus/download/dotnet/8.0. Use this link botnet --version to verify the installation of .NET SDK in our terminal. Step 4 Create a folder.There are two ways of creating a folder, we can do that by click the ** File** or** Open folder,create a **New folder and open it but we are going to use a Linus command to create our folder. *Using Linus Command to build Web App * A.Create a directory using mkdir "name" e.g (mkdir demo@emmanuel1) B.Open then folder/directory by using the command CD "name of the directory" e.g (Cd demo@emmanuel1) C.Create a Web App using this linux command dotnet new web -n "my project" -o . (dotnet new web -n demotesapp -o .) D.Click on the created directory demo@emmanuel1 and click on program.cs to open and verify the application we created. E.Run the Application by using the command dotnet run .Then copy the local host and test it on the browser. Using Linus Command to build Console App A.Create a directory mkdir "name " e.g mkdir demo@emmanuelconsole B.Open the directory cd "name of the directory" e.g cd demo@emmanuelconsole C.Create a console app by using this command dotnet new console -n "my project" -o . e.g (dotnet new console -n testconsoleapp -o .) D.check our directory, by clicking on *program.cs *.Then we use the command *dotnet run * to run it. E.To modify it, we get our code from chatGPT and paste it in our program.cs.N/B After modifying anything in c#,we do dotnet build **.Then **dotnet run to run it.

Mar 25, 2025 - 21:13
 0
How to create a Web App and Console App in C#

Web App
A web app (web application) is a software application that runs in a web browser instead of being installed on a computer or mobile device. It is built using web technologies like HTML, CSS, JavaScript, and backend languages such as C# (ASP.NET), Python (Django/Flask), PHP, or Node.js.

Console App
A console application is a simple program that runs in a command-line interface (CLI) like the Windows Command Prompt or Linux Terminal. Unlike web apps, console apps do not have a graphical user interface (GUI); instead, they rely on text-based input and output.

VS code
Visual Studio Code (VS Code) is a lightweight code editor that supports C# development through extensions. Below is a step-by-step guide to setting up and creating a C# Console Application and web application in VS Code.So to create a Web App and Console App we need to download VS code, install C# AND .NET.SDK.

Steps to creating Web App and Console App in VS code.

Step 1
Go to your browser ,type VS code, click on Visual Studio Code and download base on your Operating system.Click on the download and run it to install it on your computer.

Search Resources

Download VS code

Download

VS code

Step 2
On your VS code, click on Extension Tab,in the search field, type in C# Dev Kit and install it.N/B Dev.kit helps you to install some certain things in the background

C# Dev Kit

C# Dev Kit installation

Step 3
Click on View and click on Command pallet.Type in Install new .NET SDK.click on Install .NET SDK .Wait for it to install ,after which you reload the window.You can download it manually through this link.https://dotnet.microsoft.com/enus/download/dotnet/8.0.
Use this link botnet --version to verify the installation of .NET SDK in our terminal.

View+Command pallet

Search for install .NET SDK

Install .NET SDK

Installing

Verifing .NET SDK installation

Step 4
Create a folder.There are two ways of creating a folder, we can do that by click the ** File** or** Open folder,create a **New folder and open it but we are going to use a Linus command to create our folder.

Open folder

New folder

Create Folder

Created Folder

*Using Linus Command to build Web App *

A.Create a directory using mkdir "name" e.g (mkdir demo@emmanuel1)

mkdir

B.Open then folder/directory by using the command CD "name of the directory" e.g (Cd demo@emmanuel1)

cd demo@emmanuel1

C.Create a Web App using this linux command dotnet new web -n "my project" -o . (dotnet new web -n demotesapp -o .)

Created empty web App

D.Click on the created directory demo@emmanuel1 and click on program.cs to open and verify the application we created.

Demo@emmanuel1

program.cs

Created Application

E.Run the Application by using the command dotnet run .Then copy the local host and test it on the browser.

dotnet run

Local host

Testing the application

Using Linus Command to build Console App

A.Create a directory mkdir "name " e.g mkdir demo@emmanuelconsole

Create a directory

B.Open the directory cd "name of the directory" e.g cd demo@emmanuelconsole

Cd directory

C.Create a console app by using this command dotnet new console -n "my project" -o . e.g (dotnet new console -n testconsoleapp -o .)

Created console app

D.check our directory, by clicking on *program.cs *.Then we use the command *dotnet run * to run it.

Program.cs

Dotnet run

E.To modify it, we get our code from chatGPT and paste it in our program.cs.N/B After modifying anything in c#,we do dotnet build **.Then **dotnet run to run it.

Generated code in chatGPT

Code pasted in program.cs

dotnet build

Created game in c#