New solution + Classlib Project + Testproject
$AppName = Read-Host -Prompt 'Input your project (folder) name'
$TargetFolder="$AppName"
Write-Host "Creating a new project '$AppName' in '$TargetFolder'"
$confirmation = Read-Host "Are you sure you want to proceed? [y/N]"
if ($confirmation -ne 'y') {
Write-Host "Closing.."
Start-Sleep -Seconds 2
Exit
}
New-Item -ItemType Directory -Force -Path $TargetFolder
Push-Location $TargetFolder
git init
# solution
dotnet new sln -n $AppName
dotnet new gitignore
dotnet new globaljson
dotnet new nugetconfig
dotnet new classlib -n $AppName
dotnet sln add $AppName
# unit test project
$TestProject = "$AppName.Tests";
dotnet new nunit -n $TestProject
dotnet add $TestProject package NSubstitute
dotnet sln add $TestProject
dotnet add $TestProject reference $AppNameNew WebApi solution with database adapters
$AppName = Read-Host -Prompt 'Input your project (folder) name'
$TargetFolder="./$AppName"
$AppNameTitleCase = (Get-Culture).TextInfo.ToTitleCase($AppName)
#$path = Get-Location
#$newPath = Join-Path -Path $path -ChildPath $TargetFolder
Write-Host "Creating a new project '$AppNameTitleCase' in '$TargetFolder'"
$confirmation = Read-Host "Are you sure you want to proceed? [y/N]"
if ($confirmation -ne 'y') {
Write-Host "Closing.."
Start-Sleep -Seconds 2
Exit
}
New-Item -ItemType Directory -Force -Path $TargetFolder
Push-Location $TargetFolder
# pick what you need:
# init git
git init
# solution
dotnet new sln -n $AppNameTitleCase
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
# adapter project(s)
dotnet new classlib -n LicenseDbAdapter
dotnet sln add LicenseDbAdapter
dotnet add LicenseDbAdapter reference Domain
dotnet new classlib -n DbAdapter
dotnet sln add DbAdapter
dotnet add DbAdapter reference Domain
# wiring project
dotnet new classlib -n Wiring
dotnet sln add Wiring
dotnet add Wiring reference Domain
dotnet add Wiring reference LicenseDbAdapter
dotnet add Wiring reference DbAdapter
# 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
Pop-Location
# # copy content files
# Copy-Item -Path "files/AssemblyInfo.cs" -Destination "$TargetFolder/Domain"
# Copy-Item -Path "files/DomainPorts.cs" -Destination "$TargetFolder/Domain"
# Copy-Item -Path "files/IAdapterResolver.cs" -Destination "$TargetFolder/Domain"
# Copy-Item -Path "files/Wiring.cs" -Destination "$TargetFolder/Wiring"
# # remove unused files
# Remove-Item "$TargetFolder/Domain/Class1.cs" -ErrorAction Ignore
# Remove-Item "$TargetFolder/Domain.Tests/Class1.cs" -ErrorAction Ignore
# Remove-Item "$TargetFolder/Adapters/Class1.cs" -ErrorAction Ignore
# Remove-Item "$TargetFolder/Wiring/Class1.cs" -ErrorAction Ignore
#if (Test-Path $FileName)
#{
# Remove-Item $FileName
#}
Write-Host "Finished"
745200cookie-checkC# Kickstart