.net core – create project and adding reference by command line only

dotnet new sln # new solution file
mkdir webapi
cd webapi
dotnet new webapi # new project named webapi
dotnet add package Autofac # try to add Autofac
dotnet add package Autofac.Extensions.DependencyInjection
dotnet add package MongoDB.Driver

cd ..
mkdir webapi_test ###important: dont’ name folder to be ‘xunit’, command has bugs for it
dotnet new xunit
dotnet add reference ../webapi/webapi.csproj
dotnet add package Microsoft.AspNetCore.Mvc
dotnet restore # download all references

This entry was posted in .net core. Bookmark the permalink.