Skip to content

Instantly share code, notes, and snippets.

@akamsteeg
Last active September 17, 2018 20:40
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 akamsteeg/daa7edce3fb1f9f3da52ce20f60a40e8 to your computer and use it in GitHub Desktop.
Save akamsteeg/daa7edce3fb1f9f3da52ce20f60a40e8 to your computer and use it in GitHub Desktop.
Create a .NET Core project of the specified type with a solution and optionally a XUnit unit test project
param(
[Parameter(Mandatory=$True)][string]$projectName,
[Parameter(Mandatory=$True)][string]$projectType,
[Parameter(Mandatory=$True)][bool]$createUnitTest=$False
)
dotnet new sln --name $projectName
dotnet new $projectType --name $projectName
dotnet sln $projectName.sln add $projectName\$projectName.csproj
if ($createUnitTest -eq $True)
{
$testProjectName = $projectName + '.Tests'
dotnet new xunit --name $testProjectName
dotnet add $testProjectName\$testProjectName.csproj reference $projectName\$projectName.csproj
dotnet sln $projectName.sln add $testProjectName\$testProjectName.csproj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment