ABC Company is building a new EShopping platform using a Microservices Architecture.
The Backend team has been assigned to develop the first microservice: Product Service, which is responsible for managing product catalogs and inventory.
The Tech Lead defines the following requirements:
After completing this epoch, students will be able to:
The .NET CLI (Command Line Interface) is the official command-line tool provided by Microsoft for developing .NET applications.
It allows developers to:
In professional software development, projects are often initialized using the .NET CLI instead of Visual Studio.
Check the installed SDK version.
1
dotnet --version
Example output:
1
8.0.412
List all installed SDKs.
1
dotnet --list-sdks
1
2
mkdir EShopping
cd EShopping
Verify the current working directory.
1
pwd
1
dotnet new sln -n EShopping
Expected output:
1
EShopping.sln
1
2
3
4
5
EShopping
├── src
├── tests
├── docs
└── docker
Create the directories.
1
2
3
4
mkdir src
mkdir tests
mkdir docs
mkdir docker
Move into the src directory.
1
cd src
Create an ASP.NET Core Web API project.
1
dotnet new webapi -n ProductService
The resulting structure:
1
2
src
└── ProductService
1
cd ..
1
dotnet sln add src/ProductService/ProductService.csproj
Verify the solution.
1
dotnet sln list
Expected output:
1
2
3
Project(s)
----------
src/ProductService/ProductService.csproj
1
dotnet build
Expected output:
1
Build succeeded.
1
2
3
cd src/ProductService
dotnet run
1
dotnet run --project src/ProductService
Example output:
1
2
3
4
5
Now listening on:
http://localhost:5000
https://localhost:5001
Open one of the following URLs in your browser:
1
https://localhost:5001/swagger
or
1
http://localhost:5000/swagger
If the Swagger UI appears successfully, the project has been created correctly.
1
2
3
4
5
6
7
8
ProductService
│
├── Program.cs
├── appsettings.json
├── appsettings.Development.json
├── ProductService.csproj
├── Properties
└── obj
| File/Folder | Description |
|---|---|
| Program.cs | The application’s entry point. Configures dependency injection, middleware, and routing. |
| appsettings.json | Stores application configuration such as logging, connection strings, and other settings. |
| appsettings.Development.json | Overrides configuration when running in the Development environment. |
| ProductService.csproj | Defines the project, target framework, package references, and build configuration. |
| Properties/launchSettings.json | Contains launch profiles for local development. |
| obj | Auto-generated build artifacts. Do not modify manually. |
Run the application with Hot Reload enabled.
1
dotnet watch
or
1
dotnet watch run
The application will automatically rebuild whenever a source file is saved.
1
2
3
4
5
6
7
8
9
10
11
12
13
EShopping
│
├── docker
├── docs
├── tests
├── src
│ └── ProductService
│ ├── Program.cs
│ ├── appsettings.json
│ ├── ProductService.csproj
│ └── Properties
│
└── EShopping.sln
Complete the following tasks:
EShopping solution.srctestsdocsdockerProductService project using the .NET CLI.In Epoch 2, we will refactor the generated Web API project into a Clean Architecture by separating it into multiple projects:
Students will learn why this layered architecture is widely adopted in enterprise-grade Microservices systems.