PWI Software Documentation Help

Advanced Software Learning Paths

Efficient Code Sharing in C# .NET Using Class Libraries and NuGet Packages

This course is intended to improve improving your code sharing and modularization skills. It covers the essentials of creating C# class libraries, working with NuGet packages, and leveraging private NuGet feeds hosted on GitHub. The focus is on enhancing collaboration, maintainability, and reusability by adopting best practices and streamlined approaches.

Course Details

Target Audience: Intermediate C# .NET Programmers

Duration: 3 Days (3 hours per day, 1 hour per session)

Prerequisites

  1. Intermediate knowledge of C# programming: Participants should have a good understanding of C# syntax, basic programming constructs, and experience with creating and working on C# projects.

  2. Familiarity with .NET Core/.NET 5 or later: Participants should have experience working with .NET Core or later versions, including project structure, dependencies, and configuration.

  3. Basic understanding of Git and GitHub: Participants should know how to use Git for version control, including cloning repositories, committing changes, pushing and pulling code, and resolving conflicts. They should also be familiar with GitHub features like creating and managing repositories, branching, and pull requests.

  4. Experience with an IDE: Participants should be comfortable using an IDE (ex Visual Studio, VS Code, Jetbrains Rider, etc.) for C# development, including creating projects, navigating the IDE, debugging, and managing NuGet packages.

  5. Familiarity with object-oriented programming (OOP) concepts: Participants should understand basic OOP concepts such as inheritance, encapsulation, polymorphism, and abstraction, and be able to apply them in their C# code. (see 10.5 Programming Concepts Library)

  6. Basic understanding of software architecture and design patterns: While not strictly required, having some knowledge of software architecture principles and common design patterns can help participants better understand the motivations behind code sharing and modularization.

Course Material

Session 1: Class Library Essentials (1 hour + practice)

Session 2: Introduction to NuGet (1 hour + practice)

  1. What is NuGet? | NuGet 101 \[1 of 5\]

  2. Install and Use a NuGet Package with Visual Studio | NuGet 101 \[2 of5\]

  3. Install and Use a NuGet Package with the .NET CLI | NuGet 101 \[3 of 5\]

  4. Create and Publish a NuGet Package with Visual Studio | NuGet 101 \[4 of 5\]

  5. Create and Publish a NuGet Package with the .NET CLI | NuGet 101 \[5 of 5\]

  6. Recap: Creating and Publishing a NuGet Package - DEVOPS (C#/.NET)

    • This video is useful as it shows how to specify properties in .csproj files

    • We will need to publish to a private NuGet feed.

  7. How to create a NuGet package targeting multiple frameworks...

    • Our API is written in .NET 6 and the automations software is in .NET Framework v4.8.1, so we need to target multiple frameworks for our project. This will require some manual setup.

    • Note that it is better to use .NET standard instead of targeting multiple frameworks

Session 3: Creating Custom NuGet Packages (1 hour + practice)

Supplemental Resources:

16 February 2024