DotNet core scripting new environment

Date: 2020-01-22
# create new solution file
dotnet new sln

# create Class library
dotnet new classlib

# create Console Application
dotnet new console

# create NUnit 3 Test Project
dotnet new nunit

# create ASP.NET Core Web API
dotnet new webapi

# ASP.NET Core Empty
dotnet new web

# more
dotnet new -h

# add project to solution file
dotnet sln add $Project

# add references
dotnet add $Project package $NuGetPackage
dotnet add $Project reference $ProjectPath
#!/bin/bash
# new solution script
# use --dry-run to test command effects
# use --language C# | F# | VB for creating for another language
git init
# solution
dotnet new sln -n Solution
dotnet new gitignore
dotnet new globaljson
dotnet new nugetconfig

# domain project
dotnet new classlib -n Domain
dotnet sln add Domain

# unit test project
dotnet new nunit -n Domain.Tests
dotnet add Domain.Tests package NSubstitute
dotnet sln add Domain.Tests
dotnet add Domain.Tests reference Domain

# wiring project
dotnet new classlib -n Wiring
dotnet sln add Wiring
dotnet add Wiring reference Domain
dotnet add Wiring package Autofac

# use webapi and/or console

# webapi project
#dotnet new webapi -n WebApi
#dotnet sln add WebApi
#dotnet add WebApi reference Domain
#dotnet add WebApi reference Wiring

# console project
dotnet new console -n ConsoleApp
dotnet sln add ConsoleApp
dotnet add ConsoleApp reference Domain
dotnet add ConsoleApp reference Wiring
#!/bin/bash
# new solution script
# use --dry-run to test command effects
# use --language C# | F# | VB for creating for another language
git init
dotnet new sln -n Solution
dotnet new gitignore
dotnet new globaljson
dotnet new nugetconfig

dotnet new classlib -n Domain
dotnet sln add Domain

dotnet new classlib -n Wiring
dotnet sln add Wiring
dotnet add Wiring reference Domain

dotnet new nunit -n Domain.Tests
dotnet sln add Domain.Tests
dotnet add Domain.Tests reference Domain

dotnet new webapi -n WebApi
dotnet sln add WebApi
dotnet add WebApi reference Domain
dotnet add WebApi reference Wiring

dotnet new classlib -n LogAdapter
dotnet sln add LogAdapter
dotnet add LogAdapter reference Domain

dotnet new classlib -n ConfigAdapter
dotnet sln add ConfigAdapter
dotnet add ConfigAdapter reference Domain

dotnet add Wiring reference LogAdapter
dotnet add Wiring reference ConfigAdapter

dotnet add Domain.Tests package NSubstitute
dotnet add LogAdapter package log4net
dotnet add Wiring package Autofac
dotnet add ConfigAdapter package  Microsoft.Extensions.Configuration.Json

dotnet publish --configuration Release

# From the command line, run the app: dotnet <app_assembly>.dll.
# In a browser, navigate to http://<serveraddress>:<port> to verify the app works on Linux locally.

A simple new console app

mkdir $projectname
cd $projectname
git init

dotnet new sln -n Solution
dotnet new gitignore
dotnet new globaljson
dotnet new nugetconfig

dotnet new console -n ConsoleApp --use-program-main
dotnet sln add ConsoleApp
32250cookie-checkDotNet core scripting new environment