To create a .NET Core class library project, we need to use the same command, dotnet new, but with a class library type project template, whose short name is classlib. Let's navigate to the folder (in our case, it's D:DotNetCore) in the console window and enter the following command:
dotnet new classlib -n "CustomLibrary" -lang C#
This will create a C# project named CustomLibrary.csproj and a C# class file, Class1.cs, in a directory named CustomLibrary under the current directory: