Class Libraries in C#
Understanding and using class libraries is essential if you want to better organize your code, make it reusable, and make it easily distributable to other developers and teams. This course will teach you how to create, configure, test, and distribute C# class libraries.
What you'll learn
Having all your C# code in a single project can be problematic if the project gets too large and hard to understand and maintain. A single project also makes it harder to manage versions of sections of the codebase independently and makes sharing functionality with other developers, teams, and applications difficult. In this course, Class Libraries in C#, you’ll learn to use class libraries effectively to make your software development process more organized and flexible. First, you’ll explore how to create, configure, and test a class library project. Next, you’ll discover how to make the class library consumable on different versions of .NET. Finally, you’ll learn how to version and package your class library so it is easily consumable by other developers and applications. When you’re finished with this course, you’ll have the skills and knowledge of C# class libraries needed to create, organize, and share code.
Table of contents
- Introduction 2m
- Module Overview 1m
- What Is a Class Library? 1m
- Why Use Class Library Projects? 4m
- How to Create a Class Library Project in Visual Studio 3m
- Checkpoint 01 - Use the .NET CLI to Create a New Class Library Project 0m
- How to Create a Class Library Project from the Command Line 3m
- Class Libraries, Namespaces, and Assemblies 3m
- Adding Code to a Class Library Project 2m
- Referencing and Using a Class Library Project 2m
- Reusing a Class Library Project from Multiple Applications 2m
- The Different Flavors of .NET 2m
- Summary 2m
- Exercise 01 - Create and Use a Class Library Project 0m
- Introduction 1m
- Class Library Project Build Output 2m
- Understanding the ImplicitUsings Property 4m
- Checkpoint 02 - Enable Implicit Using for a Class Library Project 0m
- Understanding the TargetFramework Property 1m
- Understanding the Nullable Property 1m
- Checkpoint 03 - Enable nullable reference types for a class library project 0m
- How to Add Assembly Level Attributes to a Class Library Project 6m
- Assembly Level Attributes for Non-string Values 3m
- How to Add Assembly Level Attributes to Multiple Projects 2m
- Referencing Packages and DLLs From a Class Library Project 2m
- Summary 2m
- Exercise 02 - Adding NuGet Package References and Assembly Attributes 0m
- Introduction 2m
- An Overview of Multi-targeting 3m
- Understanding Conditional Compilation Preprocessor Directives 4m
- Adding Multi-targeting to a Class Library Project 3m
- Conditional Property Groups 4m
- The Effect of Multi-targeting on Project Properties 1m
- Adding Conditional Code for Different Targets 3m
- Checkpoint 04 - Modify a Method to Make it Return a Different Value Depending on the Target Framework 0m
- Consuming Muti-targeted Class Libraries 4m
- Preventing Bugs if New Targets Are Added 4m
- Dealing with Unsupported Operations for Some Targets 2m
- Summary 1m
- Exercise 03 - Adding Multi-Targeting Support 0m
- Introduction 1m
- Why Unit Testing Class Libraries Is Easier 2m
- Creating Unit Tests for Class Library Projects 7m
- Checkpoint 05 - Write a Test Method to Check the Return Value of a Method 0m
- Creating Unit Tests for .NET Standard 4m
- How to Access Internal Code When Unit Testing 2m
- Summary 1m
- Exercise 04 - Test a Class Library Project 0m
- Introduction 1m
- An Overview of Version Numbering in .NET 4m
- An Overview of Semantic Versioning 4m
- Setting Version Numbers for Class Libraries in Visual Studio 5m
- Setting Version Numbers for Class Library Assemblies from dotnet Build 7m
- An Overview of NuGet Packages 1m
- Creating a NuGet Package from Visual Studio 2m
- Configuring NuGet Package Properties 4m
- How to Test NuGet Packages Locally in Visual Studio 3m
- Setting NuGet Package Version Numbers in Visual Studio 2m
- Checkpoint 06 - Set the NuGet Package Version for a Class Library Project Using the Project File Properties 0m
- Setting NuGet Package Version Numbers from the Command Line 4m
- Checkpoint 07 - Use the .NET CLI to Create a NuGet Package with a Specified Version Number 0m
- An Overview of Automated Package Creation 1m
- Summary, Resources, and Further Learning 2m
- Exercise 05 - Create a NuGet Package 0m