Skip to content

Instantly share code, notes, and snippets.

@squidge
Last active June 16, 2017 15:41
Show Gist options
  • Save squidge/0292df5ee7cc1acd5b535a13e4975f33 to your computer and use it in GitHub Desktop.
Save squidge/0292df5ee7cc1acd5b535a13e4975f33 to your computer and use it in GitHub Desktop.
A quick guide to use dotnet core CLI

create and cd into app folder

~ $ mkdir myapp && cd app

create new solution file. If no name is specified file is automatically named after the parent folder

~/app $ dotnet new sln 

create a project called api from webapi template

~/app $ dotnet new webapi -n api

add api project to solution file

~/app $ dotnet sln add api/api.csproj

create a project called lib from classlib template

~/app $ dotnet new classlib -n lib

add lib project to solution file

~/app $ dotnet sln add lib/lib.csproj

reference lib project inside api project

~/app $ dotnet add api/api.csproj reference lib/lib.csproj

add nuget package to api project

~/app $ dotnet add api/api.csproj package Swashbuckle.AspNetCore

using cURL

$ curl -v -X POST -H 'Content-Type: application/json' -d '{"name":"john doe"}' http://localhost:5000/api/whatevs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment