It is not a big deal to learn dotnet cli, I just wanted to create this repository while I was practicing.
For .NET Core 2.x
mkdir dotnet-cli-usage
cd dotnet-cli-usage
mkdir src
cd src
cd src
dotnet new console
Created a new console named "dotnet-cli-usage "
if you need to re-create with same name, you must give --force parameter
cd src
dotnet new console --force
/*output is the same.*/
cd src
dotnet new console --force -n dotnet-cli-usage-console
Created a new folder named "dotnet-cli-usage-console" with .csproj and program.cs
cd src
dotnet new console --force -lang C# -n dotnet-cli-usage-console-CSharp
Created a new folder named "dotnet-cli-usage-console-CSharp" with .csproj and program.cs
cd src
dotnet new classlib -lang C# -n dotnet-cli-usage-class-lib
Created a new folder named "dotnet-cli-usage-class-lib" with .csproj and Class1.cs
cd src
dotnet add dotnet-cli-usage-console/dotnet-cli-usage-console.csproj reference dotnet-cli-usage-class-lib/dotnet-cli-usage-class-lib.csproj
cd src
dotnet new sln -n dotnet-cli-usage-solution
dotnet sln dotnet-cli-usage-solution.sln add dotnet-cli-usage-console/dotnet-cli-usage-console.csproj
dotnet sln dotnet-cli-usage-solution.sln add dotnet-cli-usage-class-lib/dotnet-cli-usage-class-lib.csproj
Default option build is Debug.
dotnet build dotnet-cli-usage-solution.sln
cd src\dotnet-cli-usage-console
dotnet build
dotnet build -c Release
dotnet build -c Release -f netcoreapp2.0
dotnet build -c Release -o output
cd src\dotnet-cli-usage-console
dotnet run
/*
Output
Hello World!
Hello from class library 'Class1'!
*/