Create a folder.
$ mkdir SampleDotNet
$ cd SampleDotNet
Create a solution file.
$ dotnet new sln
Create a web api, mvc or other type of project. See the list of available project templates for the dotnet new
command.
$ dotnet new webapi -n SampleDotNet.Api
Create a class library project.
$ dotnet new classlib -n SampleDotNet.Services
Reference the library project from the web api project.
$ dotnet add SampleDotNet.Api/SampleDotNet.Api.csproj reference SampleDotNet.Services/SampleDotNet.Services.csproj
Finally add the projects to the solution.
# Add API to solution
$ dotnet sln add SampleDotNet.Api/SampleDotNet.Api.csproj
# Add class library to solution
$ dotnet sln add SampleDotNet.Services/SampleDotNet.Services.csproj