Created
August 7, 2018 19:37
-
-
Save takekazuomi/8866dde950e424eb75569c13aa0e2c72 to your computer and use it in GitHub Desktop.
psakefile for new netcore console projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Properties { | |
$projects = @( | |
@{ | |
template="console" | |
name = "diconsole" | |
} | |
@{ | |
template="classlib" | |
name = "classlib01" | |
} | |
@{ | |
template="classlib" | |
name = "classlib02" | |
} | |
@{ | |
template="classlib" | |
name = "classlib03" | |
} | |
) | |
} | |
Task default -Depends Test | |
Task Test -Depends Compile, Clean { | |
"This is a test" | |
} | |
Task Compile -Depends Clean { | |
"Compile" | |
} | |
Task Clean { | |
"Clean" | |
} | |
Task New -Depends New-Projects, New-Sln { | |
} | |
Task New-Projects { | |
$projects | %{ | |
dotnet new $_.template -o "src/$($_.name)" --force | |
if($_.template -eq "classlib"){ | |
dotnet new xunit -o "tests/$($_.name)" --force | |
} | |
} | |
} | |
Task New-Sln { | |
dotnet new sln -n diconsole --force | |
$csprojs = (Get-ChildItem -Recurse -Include *.csproj).FullName | Resolve-Path -Relative | |
dotnet sln add $csprojs | |
# get default .gitignore from github | |
Invoke-WebRequest https://raw.githubusercontent.com/github/gitignore/master/VisualStudio.gitignore -OutFile .gitignore | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment