Skip to content

Instantly share code, notes, and snippets.

@pkskelly
Last active March 27, 2017 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pkskelly/cad8d8d5b8854e7928f6a79056cdb543 to your computer and use it in GitHub Desktop.
Save pkskelly/cad8d8d5b8854e7928f6a79056cdb543 to your computer and use it in GitHub Desktop.
Simple .NET Core CLI set of commands to create a solution with referenced projects on a Mac.
#create the solution
dotnet new sln -n CandidateManager
#create the Console project
dotnet new console --name CandidatesConsole --output CandidatesConsole
#create the web project
dotnet new webapi --name CandidatesWeb --output CandidatesWeb
# These are the templates available from ASP.NET JavaScript Services https://github.com/aspnet/JavaScriptServices
#dotnet new aurelia --name CandidatesWeb --output CandidatesWeb
#dotnet new angular --name CandidatesWeb --output CandidatesWeb
#dotnet new react --name CandidatesWeb --output CandidatesWeb
#create the Data Library
dotnet new classlib --name DataModel --output DataModel
#create the Services Library
dotnet new classlib --name Services --output Services
#Add the "applications" and the libraries to the solution
dotnet sln add ./CandidatesConsole/CandidatesConsole.csproj
dotnet sln add ./CandidatesWeb/CandidatesWeb.csproj
dotnet sln add ./DataModel/DataModel.csproj
dotnet sln add ./Services/Services.csproj
#Add the project references to the console app
dotnet add ./CandidatesConsole/CandidatesConsole.csproj reference ./DataModel/DataModel.csproj
dotnet add ./CandidatesConsole/CandidatesConsole.csproj reference ./Services/Services.csproj
#Add the project references to the web app
dotnet add ./CandidatesWeb/CandidatesWeb.csproj reference ./DataModel/DataModel.csproj
dotnet add ./CandidatesWeb/CandidatesWeb.csproj reference ./Services/Services.csproj
#add Entity Framework and tools to the Data Project
dotnet add ./DataModel/DataModel.csproj package Microsoft.EntityFrameworkCore
dotnet add ./DataModel/DataModel.csproj package Microsoft.EntityFrameworkCore.Tools
dotnet add ./DataModel/DataModel.csproj package Microsoft.EntityFrameworkCore.SQLite
dotnet add ./DataModel/DataModel.csproj package Microsoft.EntityFrameworkCore.Tools.DotNet
#restore all the pacakges
dotnet restore
#run npm install for the web project
cd CandidatesWeb
npm install
cd ..
#Build sln
dotnet build
#Run the console app
dotnet run -p ./CandidatesConsole/CandidatesConsole.csproj
#Run the web app
cd CandidatesWeb
ASPNETCORE_ENVIRONMENT=Development dotnet run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment