Skip to content

Instantly share code, notes, and snippets.

@jpolete
Created August 22, 2018 16:32
Show Gist options
  • Save jpolete/a8f77212130148c16592051cb3acadbe to your computer and use it in GitHub Desktop.
Save jpolete/a8f77212130148c16592051cb3acadbe to your computer and use it in GitHub Desktop.
Command line commands for creating a new .NET Core solution

Create .NET Core / VS Code Solution

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment