Skip to content

gusterwoei/dotnet-classlib-example

Repository files navigation

Example .NET Project: Using a Class Library in a Web API

Overview

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.

Project Structure

├── DotnetLibExample.App # The .NET Web API project
│   ├── Controllers
│   ├── Properties
├── DotnetLibExample.Lib # The reusable .NET Class Library project
│   ├── Api
│   ├── Models
│   ├── Services
└── DotnetLibExample.Test # Unit tests

Prerequisites

  • .NET SDK (8.0+ recommended)
  • Visual Studio, JetBrains Rider, or VS Code with C# extension

Getting Started

1️⃣ Clone the Repository

git clone https://github.com/gusterwoei/dotnet-classlib-example.git
cd dotnet-classlib-example

2️⃣ Build the Solution

dotnet build

This will compile all 3 projects.

3️⃣ Run the Web API

dotnet run --project DotnetLibExample.App

4️⃣ Pack the class library

cd DotnetLibExample.Lib
dotnet pack

This will generate a .nupkg bundle.

About

Example of using a .NET class library in an application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages