Building class libraries
Class library assemblies group types together into easily deployable units (DLL files). Apart from when you learned about unit testing, you have only created console applications to contain your code. To make the code that you write reusable across multiple projects, you should put it in class library assemblies, just like Microsoft does.
Good Practice: Put types that you might reuse in a .NET Standard 2.0 class library to enable them to be reused in .NET Core, .NET Framework, and Xamarin projects.
Creating a class library
The first task is to create a reusable .NET Standard class library.
- In your existing
Code
folder, create a folder namedChapter05
, with a subfolder namedPacktLibrary
. - In Visual Studio Code, navigate to File | Save Workspace As…, enter the name
Chapter05
, select theChapter05
folder, and click Save. - Navigate to File | Add Folder to Workspace…, select the PacktLibrary folder...