This repository demonstrates how to build a .NET Class Library (ClassLib) and use it in a .NET Web API application. The goal is to illustrate how to structure projects, share reusable code, and integrate a class library into a web application.
├── DotnetLibExample.App # The .NET Web API project
│ ├── Controllers
│ ├── Properties
├── DotnetLibExample.Lib # The reusable .NET Class Library project
│ ├── Api
│ ├── Models
│ ├── Services
└── DotnetLibExample.Test # Unit tests- .NET SDK (8.0+ recommended)
- Visual Studio, JetBrains Rider, or VS Code with C# extension
1️⃣ Clone the Repository
git clone https://github.com/gusterwoei/dotnet-classlib-example.git
cd dotnet-classlib-example2️⃣ Build the Solution
dotnet buildThis will compile all 3 projects.
3️⃣ Run the Web API
dotnet run --project DotnetLibExample.App4️⃣ Pack the class library
cd DotnetLibExample.Lib
dotnet packThis will generate a .nupkg bundle.